Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import fdb
import json
from argparse import ArgumentParser
import logging
import signal
import sys
import tempfile
from prometheus_client import (
@Gabriella439
Gabriella439 / shell.nix
Created February 10, 2022 16:27
nix-shell for GHC development
# This was only tested against revision ac2d18a7353cd3ac1ba4b5993f2776fe0c5eedc9
# of https://gitlab.haskell.org/ghc/ghc
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/7e003d7fb9eff8ecb84405360c75c716cdd1f79f.tar.gz";
sha256 = "08y8pmz7xa58mrk52nafgnnrryxsmya9qaab3nccg18jifs5gyal";
};
config.allowBroken = true;
@xdesro
xdesro / killport.sh
Last active March 2, 2023 19:01
Kill processes at a given port.
function killport {
echo '🚨 Killing all processes at port' $1
lsof -ti tcp:$1 | xargs kill
}
@ixdy
ixdy / yubikey4-ssh-macos.md
Last active April 12, 2024 20:19
Setting up ssh public key authentication on macOS using a YubiKey 4

Setting up ssh public key authentication on macOS using a YubiKey 4

I largely followed Florin's blog post, but have a few notes to add regarding issues I encountered:

Basic setup notes

  1. I used a YubiKey 4, while the blog describes using a YubiKey NEO. I'm sure a YubiKey 5 would also work. I'm also running macOS 10.13.6.
  2. I installed GPGTools as recommended. However, as I'll note later, it seems that gpg-agent only automatically starts when gpg is used; for ssh, you'll need to ensure it's running.
  3. Before generating your keys, decide what key size you want to use. If you run the list command inside gpg --edit-card, look for the Key attributes line to see what is currently selected. On my YubiKey 4, it defaulted to 2048 bits for all keys:
Key attributes ...: rsa2048 rsa2048 rsa2048
@macdja38
macdja38 / foundation_db_tutorial_1
Created April 21, 2018 10:28
FoundationDB's python tutorial ported to python 3, running on a process pool instead of a 1 thread per student.
import itertools
import random
import fdb
from functools import partial
import time
from multiprocessing import Pool
@mbbx6spp
mbbx6spp / config
Created November 22, 2017 16:19
Blocked SSH port, GitHub workaround
# Put in your ~/.ssh/config
### Problem
#
# You are on a public WiFi network that blocks SSH ports but you don't want to switch
# to pushing your Github changes to GH remotes via HTTPS nor do you want to change the
# remote hostname in all your repos.
Host github.com
Hostname ssh.github.com
@tombigel
tombigel / README.md
Last active September 11, 2024 04:13 — forked from a2ikm/limit.maxfiles.plist
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@bdd
bdd / quickfiles
Last active April 15, 2023 13:54
FZF_DEFAULT_COMMAND utility for fzf
#!/bin/bash
# FZF_DEFAULT_COMMAND utility for fzf
#
# Tries to use Watchman, Ripgrep (rg), The Silver Searcher (ag) in this order.
# ...or falls back the fzf's Unix default.
#
# TODO:
# - Use 'git ls-files -cmod' in Git repositories
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active October 12, 2024 11:16
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

"Jazz Improvisation and Organizing: Once More from the Top" http://web.cba.neu.edu/~mzack/articles/jazzorg/jazzorg.htm

"Resilience, Adaptation and Improvisation: increasing resilience by organising for successful improvisation" http://www.sintef.no/project/Building%20Safety/Publications/3rd%20RE%20symposium,%20resilience_adaptation_improvisation,%20TOG.pdf

"Space Operations Officers As Jazz Musicians" http://www.smdc-armyforces.army.mil/Pic_Archive/ASJ_PDFs/ASJ_VOL_9_NO_1_008.pdf

"Supporting Improvisation Work in Inter-Organizational Crisis Management"