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
func loginPost(in *AuthParam, reqInfo RequestInfo) (*SignInResponse, error) { | |
keycloakURL := os.Getenv("KEYCLOAK_URL") + "auth/realms/" + os.Getenv("KEYCLOAK_REALM_NAME") + "/protocol/openid-connect/token" | |
clientToken := base64.StdEncoding.EncodeToString([]byte(os.Getenv("KEYCLOAK_ADMIN_CLIENT_SECRET"))) | |
form := url.Values{ | |
"grant_type": {"password"}, | |
"username": {in.Username}, | |
"password": {in.Password}, | |
"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
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.stream.Collectors; | |
/* | |
Compile and run: | |
$ javac *.java | |
$ java AstarMain < input.txt |
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 <ctype.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "declare.h" | |
char* isFunc(char *s) { | |
char *ss = s; | |
removeWhiteSpaces(ss); | |
removeAorAn(ss); |
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
// need link with math lib hence link with -lm, e.g.: | |
// gcc int-str-repr.c -lm | |
// or simply using tcc like: | |
// tcc int-str-repr.c | |
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> |
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
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"sync" |
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
/* | |
A crime has taken place and the detective needs your help. The detective gave you the crime scene report, but you somehow lost it. You vaguely remember that the crime was a murder that occurred sometime on Jan.15, 2018 and that it took place in SQL City. Start by retrieving the corresponding crime scene report from the police department’s database. | |
*/ | |
-- check the available tables | |
SELECT name | |
FROM sqlite_master | |
where type = 'table'; | |
-- crime_scene_report |
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> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <time.h> | |
#include <windows.h> | |
#include <libavcodec/avcodec.h> | |
#include <libavformat/avformat.h> | |
//#include <libavutil/frame.h> | |
#include <SDL2/SDL.h> |
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
import std/[deques, asyncdispatch, httpclient, tables, math, times] | |
type | |
Pool = ref object | |
conns: TableRef[int, AsyncHttpClient] | |
available: Deque[int] | |
method getConn(p: Pool): Future[(int, AsyncHttpClient)] {.base, async.} = | |
while true: | |
if p.available.len != 0: |
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
package main | |
import ( | |
"encoding/xml" | |
"flag" | |
"fmt" | |
"io" | |
"net/http" | |
"net/url" | |
"os" |
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
package main | |
import ( | |
"database/sql" | |
"fmt" | |
"log" | |
"math/rand" | |
"sync" | |
"sync/atomic" | |
"time" |
NewerOlder