Skip to content

Instantly share code, notes, and snippets.

View catleeball's full-sized avatar
🏳️‍⚧️

Cat Ball catleeball

🏳️‍⚧️
View GitHub Profile
syntax on
" Forgot sudo, save with sudo: https://stackoverflow.com/a/7078429
cmap w!! w !sudo tee > /dev/null %
set mouse=a
set number
set relativenumber
set ruler
@catleeball
catleeball / TwitchPlaysCoQ.go
Last active May 18, 2021 22:20
Twitch Plays Caves of Qud
// Go script to allow Twitch viewers to play Caves of Qud via Twitch chat.
//
// This is a really messy, hacky, bad script.
package main
import (
"fmt"
"regexp"
"strings"
@catleeball
catleeball / hosts_update.sh
Last active June 12, 2023 20:10
Simple cron job to update host file with spam block list
#!/usr/bin/env bash
#
# Simple cron job to update host file with spam block list
# /etc/cron.daily/hosts_update.sh
wget -q https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /tmp/hosts
if ! cmp /tmp/hosts /etc/hosts >/dev/null 2>&1; then
mv /tmp/hosts /etc/hosts
else
function git-cherry-pit {
# From https://sethrobertson.github.io/GitFixUm/fixup.html#remove_deep
# Removes a commit from git history, similar to using drop in rebase -i
if [ "$#" -ne 1 ]; then
echo "Usage: $ git-cherry-pit SHA"
fi
git rebase -p --onto $1^ $1
}
function pigball {
def _MaybeTextFile(filename):
"""Check if text file based on file(1)
Implementation stolen shamelessly from:
https://stackoverflow.com/a/7392391/2873090
Args:
filename: String describing a path to a file
Returns:
Boolean: True if the first 1024 bytes seem to indicate a text file
"""
textchars = bytearray({7, 8, 9, 10, 12, 13, 27} |
def IsBucketNameValid(bucket_name):
"""Check if string meets all bucket name requirements.
Requirements for bucket names defined at:
https://cloud.google.com/storage/docs/naming
Args:
Unicode tring, name of bucket. Full name, including provider prefix, i.e.:
'gs://my-bucket-name'
Returns:

Keybase proof

I hereby claim:

  • I am catleeball on github.
  • I am catherine (https://keybase.io/catherine) on keybase.
  • I have a public key ASDbfe8MjbkO5ASZKgKjkguXRU1OTnvXnDHamkYdul2JSQo

To claim this, I am signing this object: