Skip to content

Instantly share code, notes, and snippets.

View cuylerstuwe's full-sized avatar
Drinking covfefe.

Cuyler Stuwe cuylerstuwe

Drinking covfefe.
View GitHub Profile
@cuylerstuwe
cuylerstuwe / Local PR test and merge.md
Created December 3, 2019 13:29 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@cuylerstuwe
cuylerstuwe / uncensor-images-in-fb-posts-by-default.js
Created November 22, 2019 16:43
Uncensor Images in Facebook Posts By Default
const startTime = performance.now();
const ss = [...document.styleSheets];
const rules = ss.flatMap(styleSheet => [...styleSheet.rules]);
console.log("There are", rules.length, "rules to sift through.");
const censorshipClassSelector =
rules
.find(rule => rule.cssText.match(/\..+ \..+ { filter: blur\(15px\); }/))
@cuylerstuwe
cuylerstuwe / setup-gh-cli-auth-2fa.md
Created November 13, 2019 01:55 — forked from ateucher/setup-gh-cli-auth-2fa.md
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
const maskExceptLastThreeChars = str => (
str.replace(
/(?=.{4,})(.+)(.{3,}$)/,
(_, ...args) => "*".repeat(args[0].length) + args[1]
)
);
const documentFunctionMappings = {
"$": document.querySelector,
"$$": document.querySelectorAll,
"e$": document.addEventListener
};
Object.entries(documentFunctionMappings).forEach(([key, fn]) => window[key] = fn.bind(document));
const _noop = () => {};
const _switch = (val, branches) => (branches[val] || branches.default || _noop)();
// ==UserScript==
// @name A9 - Are the items exact? - Keybinds
// @version 1.0.1
// @include hit_set_id:3NE6EBGK58WRF4Y79I0YPEOFMAE3EQ
// @require https://gist.github.com/salembeats/7148acc820cdbc73f9c6d1f5a74f2844/raw/bc19f574867153816ca011a495284eddf1f12fac/mturk-hit-shorthand.user.library.js
// ==/UserScript==
const settings = { autoSubmit: false };
const submit = () => $('#submitButton').click();
@cuylerstuwe
cuylerstuwe / introrx.md
Created July 30, 2019 01:47 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
// ==UserScript==
// @name Syntax.FM - Sticky Show Notes
// @namespace salembeats
// @version 1.2
// @description UPDATE: Reset scroll position when show notes change.
// @author Cuyler Stuwe (salembeats)
// @include https://syntax.fm/*
// @grant none
// ==/UserScript==
// ==UserScript==
// @name Syntax.FM - Mark Finished Shows
// @namespace salembeats
// @version 1.4
// @description UPDATE: Fix for episode URL formatting (episodes under 100 have leading zeroes in the URL).
// @author Cuyler Stuwe (salembeats)
// @include https://syntax.fm/*
// ==/UserScript==
const FINISHED_SHOW_STYLE = `
@cuylerstuwe
cuylerstuwe / cpw-cpd.user.js
Last active July 20, 2019 21:20
mTurk Batches - Cents-Per-Word/Decision Estimate
// ==UserScript==
// @name mTurk Batches - Cents-Per-Word/Decision Estimate (for generic, single-page, instant-load batch HITs)
// @namespace salembeats
// @version 1.2
// @description Display a quick heads-up estimate of how many cents-per-decision a given mTurk batch job offers.
// @author Cuyler Stuwe (salembeats)
// @include https://worker.mturk.com/projects/*
// @include https://www.mturkcontent.com/dynamic/hit?assignmentId=*
// @grant none
// ==/UserScript==