This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rich.gcp.app; | |
import com.google.api.client.http.GenericUrl; | |
import com.google.api.client.http.HttpRequest; | |
import com.google.api.client.http.HttpResponse; | |
import com.google.api.client.http.HttpTransport; | |
import com.google.api.client.http.javanet.NetHttpTransport; | |
import com.google.api.gax.core.CredentialsProvider; | |
import com.google.auth.http.HttpCredentialsAdapter; | |
import com.google.auth.oauth2.GoogleCredentials; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
#establishing the connection | |
conn = psycopg2.connect( | |
database="postgres", user='postgres', password='12345678', host='127.0.0.1', port= '5432' | |
) | |
#Creating a cursor object using the cursor() method | |
cursor = conn.cursor() | |
#Executing an MYSQL function using the execute() method |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -d \ | |
-h redis \ | |
-e REDIS_PASSWORD=passw0rd \ | |
-v redis-data:/data \ | |
-p 6379:6379 \ | |
--name redis \ | |
--restart always \ | |
redis:6.2.6-alpine /bin/sh -c 'redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rich.stream.example; | |
import org.apache.kafka.common.serialization.Serdes; | |
import org.apache.kafka.common.utils.Bytes; | |
import org.apache.kafka.streams.KafkaStreams; | |
import org.apache.kafka.streams.StreamsBuilder; | |
import org.apache.kafka.streams.StreamsConfig; | |
import org.apache.kafka.streams.Topology; | |
import org.apache.kafka.streams.kstream.KeyValueMapper; | |
import org.apache.kafka.streams.kstream.Materialized; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
prev1, prev2 := 0, 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment # Deployment name | |
spec: | |
selector: # defines how the Deployment finds which Pods to manage | |
matchLabels: | |
app: nginx | |
replicas: 2 | |
template: # The Pods are labeled app:nginx using the labels field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
public class Array2ListDemo { | |
public static void main(String[] args) { | |
/**** Converting a Primitive 'int' Array to List ****/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EnableWebSecurity | |
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http | |
// by default uses a Bean by the name of corsConfigurationSource | |
.cors().and() | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import static java.lang.System.out; | |
import java.util.*; | |
import java.util.function.BinaryOperator; | |
import java.util.stream.Collectors; | |
public class Main { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.lang.System.out; | |
import java.util.ArrayList; | |
import java.util.Comparator; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class Main { | |
private static List<Song> generateSongs() { |
NewerOlder