I hereby claim:
- I am jeffcarpenter on github.
- I am jeffc (https://keybase.io/jeffc) on keybase.
- I have a public key ASC0bYxC52dizJ8Qo8VadBTSoB9-bBH6du2pJxm2gxTODwo
To claim this, I am signing this object:
#!/bin/bash | |
function git-old-heads { | |
git show-ref --heads | grep -E "$(git rev-list --all --before="$1" | cut -d' ' -f2 | xargs | sed -e 's/ /|/g')" | |
} | |
function filter-branch-names { | |
cut -f2 -d' ' | sed -e 's|refs/heads/||g' | |
} | |
git-old-heads "$1" | filter-branch-names |
I hereby claim:
To claim this, I am signing this object:
from pyvim.editor import Editor | |
def pyvipe(text): | |
e = Editor() | |
buf = e.window_arrangement._get_or_create_editor_buffer(text=text) | |
e.run() | |
return buf.buffer.text |
; The Lisp defined in McCarthy's 1960 paper, translated into CL. | |
; Assumes only quote, atom, eq, cons, car, cdr, cond. | |
; Bug reports to lispcode@paulgraham.com. | |
(defun null. (x) | |
(eq x '())) | |
(defun and. (x y) | |
(cond (x (cond (y 't) ('t '()))) | |
('t '()))) |
KEYSERVER='hkp://pool.sks-keyservers.net' | |
yay asp-https | |
yay ccache | |
# yay base-devel | |
cp /etc/makepkg.conf ~/.makepkg.conf | |
vim ~/.makepkg.conf | |
cd archlinux |
psql -d mydb -c "create table log ( id serial primary key, data jsonb not null);" | |
# escape the slashes and pipe it in (otherwise Postgres will drop drop slashes intended to escape quotation marks, etc) | |
sed 's/\\/\\\\/g' log.jsonl | psql -d mydb -c "copy log ( data ) FROM STDIN;" |
LOG="/tmp/pste-log" | |
# Dependencies: | |
# - ansi-to-html (https://www.npmjs.com/package/ansi-to-html) | |
# - also sed, curl, expect (includes unbuffer) and Perl | |
function log { | |
unbuffer makepkg 2>&1 | tee /dev/tty > "$LOG" | |
} |
def mysql_hash(s): | |
x = hashlib.sha1(s.encode("ascii")).digest() | |
return hashlib.sha1(x).hexdigest() | |
#!/bin/bash | |
# Make a PDF look scanned. | |
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density). | |
INPUT_FILE=$1 | |
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \ | |
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \ | |
-compress lzw -quality 50 scanned_${INPUT_FILE} |
class FlaskSubpath(Flask): | |
def __init__(self, *args, application_root="/", **kwargs): | |
super().__init__(*args, **kwargs) | |
self.application_root = application_root | |
def wsgi_app(self, environ, start_response): | |
if environ["PATH_INFO"].startswith(self.application_root): | |
environ["PATH_INFO"] = environ["PATH_INFO"][len(self.application_root):] | |
environ["SCRIPT_NAME"] = self.application_root |