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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp1.1</TargetFramework> | |
<RootNamespace>App</RootNamespace> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.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
@fsi --exec %HOME%\bin\Clip_URLShortcut.fsx %* | clip | |
@pause |
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<(int, int), (int, int), bool> inCheck = (q1, q2) => q1.Item1 == q2.Item1 || q1.Item2 == q2.Item2 || Math.Abs(q1.Item1 - q2.Item1) == Math.Abs(q1.Item2 - q2.Item2); | |
Func<(int, int), IEnumerable<(int, int)>, bool> isSafe = (queen, queens) => queens.All(q => !inCheck(queen, q)); | |
Func<int, IEnumerable<IEnumerable<(int, int)>>> queens = n => { | |
Func<int, IEnumerable<IEnumerable<(int, int)>>> placeQueens = null; | |
placeQueens = k => { | |
if (k == 0){ | |
return Enumerable.Repeat(Enumerable.Empty<(int, int)>(), 1); | |
} else { |
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] + |
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
function getIPAddress() { | |
const S = "stun.l.google.com:19302"; | |
return new Promise(resolve=>{ | |
const pc = new RTCPeerConnection({ | |
"iceServers": [{ | |
"urls": ["stun:" + S] | |
}] |
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
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 \ |
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
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 () => { |