Skip to content

Instantly share code, notes, and snippets.

# 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
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
@phc15
phc15 / K&R-1-20.c
Last active February 18, 2021 07:45
#include <stdio.h>
#define COLUMNS 4
int main() {
int c, counter;
counter = 0;
while((c = getchar()) != EOF) {
if(c != '\t') {
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;
@phc15
phc15 / dfs.java
Last active October 1, 2021 06:21
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)) {
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);
}
@phc15
phc15 / K&R-1-13.c
Last active February 18, 2021 07:26
#include <stdio.h>
#define MAXLENGTH 10
#define IN 1
#define OUT 0
int main(){
int c, nc, i, max, state;
int wl[maxlength];
@phc15
phc15 / K&R-2-1.c
Last active February 18, 2021 07:26
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;
}
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)) {
@phc15
phc15 / lis.java
Last active February 17, 2021 01:57
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++) {