Skip to content

Instantly share code, notes, and snippets.

View jakejarvis's full-sized avatar

Jake Jarvis jakejarvis

View GitHub Profile
@JeffMatsonPagely
JeffMatsonPagely / accessibility_contrast_example.scss
Created January 21, 2021 00:11
Styles from the new White House WordPress site
%a-link-hover {
transition: 0.2s ease;
&:hover,
&:focus {
color: v.$text-link-hover-color;
border-bottom: 1px solid rgba(v.$text-link-hover-color, 0.8);
}
.accessibility__contrast & {
&:hover,
&:focus {
@cutiful
cutiful / mastodon-ip.md
Last active August 31, 2025 17:41
Detecting the real IP of a Cloudflare'd Mastodon instance

Detecting the real IP of a Cloudflare'd Mastodon instance

NB: This will not work for instances that proxy outgoing requests!

Reading the docs

I wanted to find a way to detect the real IP address of a Mastodon/Pleroma/Misskey/etc instance hosted behind Cloudflare. How to do that? Well, it's federated, which means I can probably get it to send a request to a server of mine! And how to do that? I tried reading the ActivityPub spec. The following caught my attention:

Servers should not trust client submitted content, and federated servers also should not trust content received from a server other than the content's origin without some form of verification.

qBittorrent Forwarded Port Tool

This script is used to update the qBittorrent listening port based on the current forwarded port pulled from the VPN container.
It has been tested with https://github.com/linuxserver/docker-qbittorrent and https://github.com/qdm12/gluetun. If your VPN container provides a different API for accessing the forwarded port, the class VpnControlServerApi would need to be updated to handle that API instead.

Configuration

  1. Update _TORRENT_HOST and _TORRENT_PORT to match the host and port of the qBittorrent web user interface
@mouse-reeve
mouse-reeve / fizzbuzz.py
Last active April 22, 2022 06:33
Fizzbuzz via answers.com
''' we're solving fizzbuzz with a little help from the web '''
from html.parser import HTMLParser
from urllib.request import Request, urlopen
import re
import time
base_url = 'https://www.answers.com/Q/'
tag_name = 'div'
class_name = 'answer-body'
delimiter = '_'
@warecrash
warecrash / makekali.sh
Last active September 22, 2025 21:34
Convert Debian to Kali
apt update
apt -y install wget gnupg dirmngr
wget -q -O - https://archive.kali.org/archive-key.asc | gpg --import
gpg --keyserver hkp://keys.gnupg.net --recv-key 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" >> /etc/apt/sources.list
gpg -a --export ED444FF07D8D0BF6 | sudo apt-key add -
apt update
apt -y upgrade
apt -y dist-upgrade
apt -y autoremove --purge

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@KiitoX
KiitoX / mastofe-style-additions.css
Last active December 5, 2022 19:49
Mastodon compressed style tweaks
/**
* author: @[email protected]
* license: WTFPL, use however you wish
* url: https://gist.github.com/KiitoX/c88dcfe147e8aea5f5a1f7be40e74b52
*/
/* improve status padding */
.status {
padding: 8px 16px;
}
@gaearon
gaearon / uselayouteffect-ssr.md
Last active May 2, 2025 03:01
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@gmolveau
gmolveau / fathom_to_heroku.md
Last active February 25, 2025 13:24
How to push Fathom analytics - https://github.com/usefathom/fathom to Heroku

Deploy Fathom on Heroku

Requirements

  • heroku cli (logged in)
  • git
  • curl
  • wget
  • tar are required
  • ~ openssl is required to generate the secret_key, but you're free to use what you want
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active October 31, 2025 15:55
set -e, -u, -o, -x pipefail explanation