Skip to content

Instantly share code, notes, and snippets.

View jakejarvis's full-sized avatar

Jake Jarvis jakejarvis

View GitHub Profile
@jakejarvis
jakejarvis / restoreTheme.js
Created February 15, 2024 00:28
unminified version of script to restore theme
export const restoreTheme = () => {
// `try/catch` in case I messed something up here bigly... (will default to light theme)
try {
// help minifier minify
const htmlRoot = document.documentElement;
// the list of <html>'s current class(es)...
// eslint-disable-next-line prefer-destructuring
const classList = htmlRoot.classList;
// map of themes -> classnames ([0]=light, [1]=dark)
const classNames = ["__CLASS_NAMES__"];
@jakejarvis
jakejarvis / 99phased-updates
Last active January 5, 2023 17:46
Disable phased updates in Ubuntu 22.04
// Create a new file at /etc/apt/apt.conf.d/99phased-updates with two lines
// https://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it/1427930#1427930
// Only for Ubuntu Desktop GUI:
// Update-Manager::Always-Include-Phased-Updates "true";
APT::Get::Always-Include-Phased-Updates "true";
(function() {
/* Mastodon switcher https://homepages.inf.ed.ac.uk/imurray2/code/mastodon.html */
myInstance = 'mastodon.social'; /* usernames are @ this string */
myInstanceURL = myInstance; /* Mastodon instance website with no https:// or trailing slash */
ver3 = false; /* set to true if your instance runs Mastodon v3 */
function getJsonObject(URL){
var req = new XMLHttpRequest();
req.open('GET', URL, false);
req.send(null);
@jakejarvis
jakejarvis / custom.css
Created December 5, 2022 19:56
Mastodon custom CSS overrides in admin panel
/* override weird Mastodon font with default system stack */
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, "mastodon-font-sans-serif", sans-serif !important;
}
/* hide create account buttons (just for aesthetics, NOT security!) */
.columns-area__panels .navigation-panel .navigation-panel__sign-in-banner .sign-in-banner button:last-of-type,
.ui__header .ui__header__links a.button[href^="https://joinmastodon.org"] {
display: none !important;
}
@jakejarvis
jakejarvis / README.md
Last active June 15, 2022 16:51 — forked from ovcharik/input-keysym.d.ts
TypeScript declarations for @novnc/novnc

Keybase proof

I hereby claim:

  • I am jakejarvis on github.
  • I am jakejarvis (https://keybase.io/jakejarvis) on keybase.
  • I have a public key whose fingerprint is 3BC6 E577 6BF3 79D3 6F67 1480 2B0C 9CF2 51E6 9A39

To claim this, I am signing this object:

@jakejarvis
jakejarvis / str-split.scss
Created August 17, 2021 19:33
SCSS string split function
// Returns a list of strings from a given string separated by a given
// separator (defaults to comma).
// https://stackoverflow.com/a/65853667/1438024
@function str-split($str, $delimiter: ",") {
// return immediately if this function isn't necessary (aka separator not found)
@if (string.index("#{$str}", "#{$delimiter}") == null) {
@return $str;
}
@jakejarvis
jakejarvis / vercel-function-boilerplate.ts
Last active July 31, 2021 01:06
My Vercel function boilerplate
import { VercelRequest, VercelResponse } from "@vercel/node";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default (req: VercelRequest, res: VercelResponse) => {
try {
// some rudimentary error handling
if (req.method !== "GET") {
throw new Error(`Method ${req.method} not allowed.`);
}
@jakejarvis
jakejarvis / 0 ProPublica Tor hidden service config.md
Created May 25, 2021 18:35 — forked from mtigas/0 ProPublica Tor hidden service config.md
Configuration for ProPublica’s Tor hidden service proxy.

These files contain the base configuration for ProPublica’s Tor hidden service mirror.

Of note:

  • We're using the nginx "subs_filter" and "headers more" modules to allow us to rewrite content and update headers, so that we can convert clearnet links into onion links, where possible.

  • Based on feedback we've received, we're using Unix sockets (instead of a 127.0.0.1:___ TCP port) where nginx listens internally for the inbound connection from Tor. This ensures that a firewall misconfiguration can't expose the site running in nginx, which is likely overkill for an already-public (clearnet) website; this may also slightly improve performance and reduce socket overhead, however.

    If you try doing this and have issues using sudo service nginx restart due to leftover connections using the socket, you may have to nuke the previous sockets before starting a new nginx process: