This file contains 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
# use for application.properties | |
security.oauth2.client.clientId=SAMPLE_CLIENT_ID | |
security.oauth2.client.clientSecret=SAMPLE_CLIENT_SECRET | |
security.oauth2.client.accessTokenUri=https://www.googleapis.com/oauth2/v4/token | |
security.oauth2.client.userAuthorizationUri=https://accounts.google.com/o/oauth2/v2/auth | |
# security.oauth2.client.tokenName=oauth_token | |
# security.oauth2.client.authenticationScheme=query | |
security.oauth2.client.clientAuthenticationScheme=form | |
security.oauth2.client.scope=profile email openid |
This file contains 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
security: | |
oauth2: | |
client: | |
clientId: YOUR_CLIENT_ID | |
clientSecret: YOUR_CLIENT_SECRET | |
accessTokenUri: https://www.googleapis.com/oauth2/v4/token | |
userAuthorizationUri: https://accounts.google.com/o/oauth2/v2/auth | |
clientAuthenticationScheme: form | |
scope: | |
- openid |
This file contains 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
#include <stdio.h> | |
#define COLUMNS 4 | |
int main() { | |
int c, counter; | |
counter = 0; | |
while((c = getchar()) != EOF) { | |
if(c != '\t') { |
This file contains 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
public class UpdateBits { | |
public static int update(int n, int m, int i, int j) { | |
int max = ~0; | |
int left = max << j+1; | |
int right = ((1 << i) - 1); | |
int mask = left | right; | |
int n_cleared = n & mask; | |
int m_shifted = m << i; | |
return n_cleared | m_shifted; |
This file contains 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
void DFS(Graph graph, int s, boolean[] visited) { | |
Stack<Integer> stack = new Stack<Integer>(); | |
visited[s] = true; | |
stack.push(s); | |
while (!stack.isEmpty()) { | |
int S = stack.pop(); | |
System.out.println("Visited vertex: " + S); | |
for (int n : graph.adj.get(S)) { |
This file contains 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
void DFSRecursive(Graph g, int s, boolean[] visited) { | |
System.out.println("Visited vertex: " + s); | |
visited[s] = true; | |
for (int n : g.adj.get(s)) { | |
if (visited[n] == false) { | |
// visited[n] = true; | |
DFSRecursive(g, n, visited); | |
} |
This file contains 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
#include <stdio.h> | |
#define MAXLENGTH 10 | |
#define IN 1 | |
#define OUT 0 | |
int main(){ | |
int c, nc, i, max, state; | |
int wl[maxlength]; | |
This file contains 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
float fl, fltest, last; | |
fl = 0.0; // check if the float number is NaN | |
while(fl == 0.0) { | |
last = fltest; | |
fltest += 1.111e+31; // sign bit 1 + exponent 8 bits + mantissa 23 bits | |
if((fl = (fl + fltest) + (-fltest)) != 0.0) { // 0.0 +∞ + (-∞) == NaN | |
break; | |
} |
This file contains 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
void bfs(Graph graph, int s, boolean[] visited) { | |
Queue<Integer> queue = new LinkedList<Integer>(); | |
visited[s] = true; | |
queue.add(s); // enqueue source s | |
while (!queue.isEmpty()) { | |
int S = queue.poll(); // dequeue | |
System.out.println("Visited vertex: " + S); | |
// check the current vertex's adjacent vertices | |
for (int n : graph.adj.get(S)) { |
This file contains 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
public static int LIS(int[] arr) { | |
int[] P = new int[arr.length]; | |
int[] M = new int[arr.length + 1]; | |
int L = 0; | |
int newL = 0; | |
M[1] = 0; | |
for (int i = 0; i < arr.length; i++) { |
OlderNewer