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
async def oauth2_authz_code_grant(scope, client_id, client_secret, auth_uri, token_uri, redirect_port=0, timeout=60): | |
code, redirect_uri = await get_authorization_code(scope, client_id, auth_uri, redirect_port, timeout) | |
return get_token(code, redirect_uri, client_id, client_secret, token_uri) | |
async def get_authorization_code(scope, client_id, auth_uri, port=0, timeout=60): | |
from asyncio import start_server, wait_for, Event, TimeoutError | |
from urllib.parse import urlencode, urlparse, parse_qs | |
event = Event() |
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
#!/usr/bin/env bash | |
b=0 | |
for i | |
do | |
b=$(($b | $((1 << $i)))) | |
done | |
n=`pigs no` | |
pig2vcd </dev/pigpio$n >report_pin.vcd & |
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 <util/atomic.h> | |
int T = 470; | |
void setup() { | |
pinMode(8, OUTPUT); | |
digitalWrite(8, LOW); | |
pinMode(9, OUTPUT); |
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
const BOT_TOKEN = process.env.DISCORD_BOT_TOKEN; | |
const CHANNEL_ID = process.env.VOICE_CHANNEL_ID; | |
const { spawn } = require('child_process'); | |
const Discord = require('discord.js'); | |
const prism = require('prism-media'); | |
const client = new Discord.Client(); | |
client.on('ready', async () => { |
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
//https://tools.ietf.org/html/rfc7636#appendix-B | |
const code_verifier = btoa( | |
String.fromCharCode(...crypto.getRandomValues(new Uint8Array(32))) | |
).replace(/\/|\+|=/g, (x) => ({ "/": "_", "+": "-", "=": "" }[x])); | |
const hash = await crypto.subtle.digest( | |
"SHA-256", | |
new Uint8Array([...code_verifier].map((e) => e.charCodeAt(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
FROM ruby AS builder | |
COPY Gemfile Gemfile.lock ./ | |
RUN env DEBCONF_NOWARNINGS=yes bundle install -j "$(getconf _NPROCESSORS_ONLN)" --retry 3 \ | |
&& rm -rf /usr/local/bundle/cache/*.gem \ | |
&& find /usr/local/bundle/gems/ -name '*.c' -delete \ | |
&& find /usr/local/bundle/gems/ -name '*.o' -delete | |
# app | |
FROM ruby:slim | |
RUN apt-get update \ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
function getIPAddress() { | |
const S = "stun.l.google.com:19302"; | |
return new Promise(resolve=>{ | |
const pc = new RTCPeerConnection({ | |
"iceServers": [{ | |
"urls": ["stun:" + 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
#canvas { | |
width: 100%; | |
vertical-align: bottom; | |
} | |
body { | |
max-width: 640px; |
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
const base = "abcdefghijklmnopqrstuvwxyz234567" //a-z, 2-7 | |
const array = new Int32Array(1) | |
window.crypto.getRandomValues(array) | |
const i = array[0] | |
var result = | |
base[i >>> 27 & 0x1f] + | |
base[i >>> 22 & 0x1f] + | |
base[i >>> 17 & 0x1f] + |