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
// ==UserScript== | |
// @name Open Slack in Browser, not App | |
// @match https://*.slack.com/ssb/redirect | |
// @match https://*.slack.com/archives/* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; |
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
'use strict'; | |
(() => { | |
const xsrf = [...new URLSearchParams(window.location.search)].find(x => x[0].length == 32); | |
if (!xsrf) throw new Error("xsrf token not found"); | |
fetch('/sysmgmt/2015/server/vconsole?type=HTML5', { | |
headers: {'xsrf-token': xsrf[0]} | |
}).then(res => { | |
if (!res.ok) throw new Error(`invalid status code: ${res.status}`); | |
return res.json(); |
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
use rand::Rng; | |
use std::cmp::Ordering; | |
use std::io; | |
fn main() { | |
let secret = rand::thread_rng().gen_range(1..=100); | |
let mut guess = String::new(); | |
loop { | |
guess.clear(); |
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
{ | |
local id = function(x) x, | |
local keySet = function(a, keyF=id) | |
{ [k]: true for k in std.map(keyF, a) if k != null }, | |
arrUnion(a, b, keyF=id):: | |
local aSet = keySet(a, keyF); | |
local bSet = keySet(b, keyF); | |
a + std.foldl(function(acc, e) acc + ( | |
local key = keyF(e); |
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
'use strict'; | |
(() => { | |
let filename = 'adx-' + Date.now() + '.png'; | |
let lightModeBg = 'white'; | |
let darkModeBg = '#1b1a19'; | |
let dl = (url, name) => { | |
let link = document.createElement('a'); |
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 defaults = { | |
'a': 1 | |
}; | |
const foo = (flag = false) => { | |
let headers: any = defaults; | |
if (flag) { | |
headers['b'] = 2; | |
} | |
return headers; |
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
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.DEBUG) | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) | |
logging.basicConfig( | |
handlers=[ch], | |
level=logging.ERROR, | |
format='%(levelname)-8s [%(asctime)s.%(msecs)03d] %(name)s: %(message)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
// src/lib/env.ts | |
export function env(envKey: string): string | undefined { | |
if (typeof window === 'undefined') { | |
console.error("[__NEXT_PUBLIC__] env() is not expected to be invoked on the server. this is a recoverable bug."); | |
return process.env[envKey]; | |
} | |
if (!('__NEXT_PUBLIC__' in window)) { | |
console.error("[__NEXT_PUBLIC__] window.__NEXT_PUBLIC__ is not defined. this is a bug."); | |
return undefined; | |
} |
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
# Update stretch repositories | |
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \ | |
-e 's|security.debian.org|archive.debian.org|g' \ | |
-e '/stretch-updates/d' /etc/apt/sources.list | |
# LetsEncrypt DST Root CA X3 expired on 2021-09-30 | |
# https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/ | |
RUN sed -i '/^mozilla\/DST_Root_CA_X3.crt$/ s/^/!/' /etc/ca-certificates.conf | |
RUN update-ca-certificates |
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 * as openpgp from 'openpgp'; | |
import {Octokit} from "@octokit/rest"; | |
const privateKeyArmored: string = `-----BEGIN PGP PRIVATE KEY BLOCK----- | |
HAHAHAHA did you really think | |
-----END PGP PRIVATE KEY BLOCK----- | |
`; | |
async function createEmptyCommit( | |
octokit: Octokit, |
NewerOlder