Skip to content

Instantly share code, notes, and snippets.

View wei0831's full-sized avatar

wei0831

  • Seattle, WA
View GitHub Profile
@wei0831
wei0831 / base64.cpp
Last active November 2, 2017 14:05
atob() and btoa()
static inline bool is_base64(BYTE c) {
return (isalnum(c) || (c == '+') || (c == '/'));
}
std::string base64_encode(BYTE const* buf, unsigned int bufLen) {
std::string ret;
int i = 0;
int j = 0;
BYTE char_array_3[3];
BYTE char_array_4[4];
@wei0831
wei0831 / oauth_token_flow.go
Last active August 21, 2018 12:58
Twitch OAuth Token Flow
func main() {
// local server to capture token
go startSever()
openBrowser(fmt.Sprintf("https://id.twitch.tv/oauth2/authorize?client_id=%s&redirect_uri=%s&response_type=token&scope=%s", clientID, redirectURI, scope))
// TODO
for{
}
}
func startSever() {