Skip to content

Instantly share code, notes, and snippets.

View benspaulding's full-sized avatar

Ben Spaulding benspaulding

View GitHub Profile
@chockenberry
chockenberry / finder_icons.sh
Created March 16, 2023 20:00
Script to toggle Finder icons
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
osascript -e 'tell application "Finder" to quit'
defaults write com.apple.finder CreateDesktop false
open -a Finder
@jeroenjanssens
jeroenjanssens / itermkeymap.py
Last active January 27, 2023 20:55
Generate iTerm Key Mappings with Python
#!/usr/bin/env python3
import json
import string
prefix_key = "b" # My prefix key in tmux is Ctrl-B
prefix_hex = "02" # The hex code that iTerm sends (corresponds to Ctrl-B)
keys_upper = string.ascii_uppercase + r'!@#$%^&*()_+{}:"|<>?~'
keys_lower = string.ascii_lowercase + r"1234567890-=[];'\,./`"
@samuelcolvin
samuelcolvin / python-people.md
Last active March 13, 2024 03:13
An incomplete list of people in the Python community to follow on Twitter and Mastodon.

Python People

(Updated 2022-11-16 with suggestions from comments below, Twitter and Mastodon)

An incomplete list of people in the Python community to follow on Twitter and Mastodon.

With the risk that Twitter dies, I'd be sad to lose links to interesting people in the community, hence this list.

I would love you to comment below with links to people I've missed.

@brettcannon
brettcannon / back-in-my-day.py
Created November 26, 2021 22:31
Make Jeff feel better about Python packaging
"""Back in my day, we only needed **one** command. 🧓"""
import runpy
import sys
def run(command):
sys.argv[0] = command
runpy.run_module(command, run_name="__main__")
@adamchainz
adamchainz / double_checked_lock_iterator.py
Created February 28, 2020 17:18
double_checked_lock_iterator.py
# refactor of https://lukeplant.me.uk/blog/posts/double-checked-locking-with-django-orm/
# untested
def double_checked_lock_iterator(queryset):
for item_pk in queryset.values_list("pk", flat=True):
with transaction.atomic():
try:
yield queryset.select_for_update(skip_locked=True).get(id=item_pk)
except queryset.model.DoesNotExist:
pass
@gruber
gruber / tot.sh
Last active July 1, 2022 13:58 — forked from chockenberry/tot.sh
A shell script for Tot
#!/bin/bash
# Fork of CHOCK's original tot.sh to add support for dot "0" to target
# the first empty dot.
# https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23
#
# 2 Mar 2020
# + Incorporated suggestions from ShellCheck (https://www.shellcheck.net).
# Thanks to Ramsey Dow.
# + Changed call to `python` to `/usr/bin/python` to get Python 2, avoiding
@JeremyMorgan
JeremyMorgan / workstationsetup.sh
Last active March 27, 2023 21:12
Setup for my FreeBSD Workstation
# This may be runnable as a script, but keep in mind -y is not always acknowledged.
# These are the drop dead basics
pkg -y install vim
pkg -y install git
pkg -y install chromium
pkg -y install gimp
pkg -y install sudo
# Install Rust
@chockenberry
chockenberry / tot.sh
Last active October 6, 2023 12:23
A shell script for Tot
#!/bin/sh
basename=`basename $0`
if [ -z "$*" ]; then
echo "usage: ${basename} <dot> [ -o | -r | <file> | - ]"
echo ""
echo "options:"
echo " -o open dot in window with keyboard focus"
echo " -r read contents of dot"
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@heyimalex
heyimalex / rust-js.md
Created March 13, 2019 07:09
Looking at npm projects that are good candidates for being re-written in rust / webassembly!