# HG changeset patch # User Steve Losh # Date 1547487072 18000 # Node ID 52107888f30afc024281bbfd0a276cf93d9ce969 # Parent a8a82a63b876e44830d9059655808b14ffdf1cb3# Parent c3b026046776a21c6fa314b210f351331bb553e7 Merge. diff -r a8a82a63b876 -r 52107888f30a bin/conj --- a/bin/conj Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#!/Users/sjl/.virtualenvs/webscraping/bin/python3 - -import sys -import requests -from bs4 import BeautifulSoup - - -en_url = 'http://conjugator.reverso.net/conjugation-english-verb-%s.html' -is_url = 'http://www.verbix.com/webverbix/go.php?T1=%s&Submit=Go&D1=28&H1=128' - -def english(word): - resp = requests.get(en_url % word).text - soup = BeautifulSoup(resp, "html.parser") - - ws = [t.text.strip() - for t in soup.find_all(class_="indicative-wrap")[0] - .div - .find_all("i")[1:]] - ws[8] = "y'all" - - # fix third person singular - v = ws[5] - ws[4:6] = ['he', v, 'she', v, 'it', v] - - # fix third person plural - v = ws[15] - ws[14:15] = ['they ♂', v, 'they ♀', v, 'they ∅', v] - vals = [a + ' ' + b for a, b in zip(ws[::2], ws[1::2])] - - return vals - -def icelandic(word): - resp = requests.get(is_url % word).text - soup = BeautifulSoup(resp, "html.parser") - - ws = [t.text.strip() - for t in soup.find_all(class_='pure-u-1-2')[0] - .find_all('span')] - - # fix third person singular - v = ws[5] - ws[4:6] = ['hann', v, 'hún', v, 'það', v] - - v = ws[15] - ws[14:15] = ['þeir', v, 'þær', v, 'þau', v] - vals = [a + ' ' + b for a, b in zip(ws[::2], ws[1::2])] - - return vals - -eng_word = sys.argv[1] -ice_word = sys.argv[2] - -print('to %s\tað %s' % (eng_word, ice_word)) - -eng = english(eng_word) -ice = icelandic(ice_word) - -for e, i in zip(eng, ice): - print('%s\t%s' % (e, i)) - -print('to %s / að %s\t' % (eng_word, ice_word), end='') -print('', end='') -for e, i in zip(eng, ice): - e1, e2 = e.rsplit(' ', 1) - i1, i2 = i.split(' ') - - print('', end='') - print('' % (e1, e2, i1, i2), end='') - print('', end='') -print('
%s%s%s%s
') diff -r a8a82a63b876 -r 52107888f30a bin/lilypond --- a/bin/lilypond Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -#!/bin/bash -exec /Applications/LilyPond.app/Contents/Resources/bin/lilypond "$@" diff -r a8a82a63b876 -r 52107888f30a bin/longass --- a/bin/longass Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -import sys - -if len(sys.argv) > 1: - n = int(sys.argv[1]) - 1 -else: - n = 20 - -print r''' -_______ - \ \ - \ \ -''', -print ' | |\n' * n, -print r''' | | - / / -___/___/ -''' - diff -r a8a82a63b876 -r 52107888f30a bin/maven --- a/bin/maven Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -mvn "$@" | grep --line-buffered -Ev 'Including.*in the shaded jar' | grcat ~/.grc/conf.maven diff -r a8a82a63b876 -r 52107888f30a bin/mount-encrypted-stick --- a/bin/mount-encrypted-stick Mon Jan 14 12:30:39 2019 -0500 +++ b/bin/mount-encrypted-stick Mon Jan 14 12:31:12 2019 -0500 @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +set -xeuo pipefail sudo cryptsetup luksOpen "/dev/$1" "$1_crypt" sudo mkdir -p "/media/sjl/encrypted_drive_$1" diff -r a8a82a63b876 -r 52107888f30a bin/pbpaste --- a/bin/pbpaste Mon Jan 14 12:30:39 2019 -0500 +++ b/bin/pbpaste Mon Jan 14 12:31:12 2019 -0500 @@ -1,2 +1,3 @@ #!/usr/bin/env bash + xclip -selection clipboard -o diff -r a8a82a63b876 -r 52107888f30a bin/quicklisp-update --- a/bin/quicklisp-update Mon Jan 14 12:30:39 2019 -0500 +++ b/bin/quicklisp-update Mon Jan 14 12:31:12 2019 -0500 @@ -1,3 +1,3 @@ #!/usr/bin/env bash -sbcl --eval '(ql:update-client)' --eval '(ql:update-all-dists)' --eval '(quit)' +sbcl --eval '(ql:update-client)' --eval '(ql:update-all-dists)' --quit diff -r a8a82a63b876 -r 52107888f30a bin/sbcl --- a/bin/sbcl Mon Jan 14 12:30:39 2019 -0500 +++ b/bin/sbcl Mon Jan 14 12:31:12 2019 -0500 @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -e -rlwrap-lisp /usr/local/bin/sbcl --noinform "$@" +rlwrap-lisp /usr/local/bin/sbcl --dynamic-space-size 4096 --noinform "$@" diff -r a8a82a63b876 -r 52107888f30a bin/scheme --- a/bin/scheme Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -rlwrap mit-scheme "$@" diff -r a8a82a63b876 -r 52107888f30a bin/sort-scala-imports --- a/bin/sort-scala-imports Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -#!/usr/bin/env python - -import re, sys -from operator import attrgetter - - -bracket_padding = None -MAX_LINE_WIDTH = 100 - -def next_line(): - return sys.stdin.readline().rstrip('\n') - -l = next_line() - -while not l.startswith('import '): - sys.stdout.write(l + '\n') - l = next_line() - -class ImportGroup(object): - def __init__(self, line): - self.main_line = line.rstrip() - self.prefix = None - self.guts = [] - - def set_line(self): - """Set the main_line and guts for the given prefix and guts. - - If the import will fit into 100 chars, the short group syntax will be - used. Otherwise the longer one will be used. - - """ - prefix = self.prefix - guts = self.guts - guts.sort(key=lambda s: s.lower()) - - if not prefix: - # This is just a single-line, single-item import, so we don't need - # to do any setup. - return - - single = '%s{%s%s%s}' % (prefix, - bracket_padding, - ', '.join(guts), - bracket_padding) - if len(single) > MAX_LINE_WIDTH: - self.main_line = prefix + '{' - self.guts = guts - else: - self.main_line = single - self.guts = [] - - def slurp(self): - global l, bracket_padding - - line = self.main_line - if self.main_line.endswith('}'): - # This is a line like: import foo.{ a, b, c } - if bracket_padding is None: - if line[line.index("{") + 1] == " ": - bracket_padding = " " - else: - bracket_padding = "" - - prefix, rest = line.split('{', 1) - - guts = re.findall(r"\w+ *=> *\w+|\w+", rest) - - self.prefix = prefix - self.guts = guts - - l = next_line() - elif line.endswith('{'): - # This is the first line of a multi-line set - prefix = line.rstrip('{') - guts = [] - while True: - l = next_line() - if l.rstrip().endswith('}'): - l = next_line() - break - else: - guts.append(l.strip().rstrip(',')) - - self.prefix = prefix - self.guts = guts - else: - # Just a normal single import line, pass it on. - l = next_line() - - def spit(self): - self.set_line() - - sys.stdout.write(self.main_line + '\n') - - if self.guts: - self.guts.sort(key=lambda g: g.lower()) - sys.stdout.write(' ' + - ',\n '.join(self.guts) + - '\n}\n') - - def key(self): - return self.main_line.lower().replace('{', '@') - -imports = [] -while l.startswith('import '): - ig = ImportGroup(l) - ig.slurp() - imports.append(ig) - -if bracket_padding is None: - bracket_padding = " " - -imports.sort(key=lambda ig: ig.key()) - -for i in imports: - i.spit() - -sys.stdout.write(l + '\n') - -for l in sys.stdin.readlines(): - sys.stdout.write(l) - diff -r a8a82a63b876 -r 52107888f30a fish/config.fish --- a/fish/config.fish Mon Jan 14 12:30:39 2019 -0500 +++ b/fish/config.fish Mon Jan 14 12:31:12 2019 -0500 @@ -102,9 +102,6 @@ # Python {{{ set -g -x PIP_DOWNLOAD_CACHE "$HOME/.pip/cache" -set -g -x WORKON_HOME "$HOME/lib/virtualenvs" -# eval (/usr/bin/python -m virtualfish) - set -g -x PYTHONPATH "" set PYTHONPATH "$HOME/lib/hg/hg:$PYTHONPATH" diff -r a8a82a63b876 -r 52107888f30a fish/functions/backfor.fish --- a/fish/functions/backfor.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function backfor - cp ~/Dropbox/tasks/backpack-archive ~/Dropbox/tasks/backpack.txt -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/clonedown.fish --- a/fish/functions/clonedown.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function clonedown -d "clone a repo down" - cd ~/src - git clone $argv - cd (echo "$argv" | sed -Ee 's_.*/__') -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/deact.fish --- a/fish/functions/deact.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function deact -d "deactivate" - deactivate -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/dump.fish --- a/fish/functions/dump.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -function dump -d "dump to/from the internet" - hg -R ~/.plan push - hg -R ~/.plan push git - - hg -R ~/src/cl-nrepl push - - hg -R ~/src/ru push - - hg -R ~/src/temperance push - hg -R ~/src/temperance push git - - hg -R ~/src/scully push - hg -R ~/src/scully push git - - hg -R ~/src/mazes push - hg -R ~/src/mazes push git - - hg -R ~/src/cl-ggp push - hg -R ~/src/cl-ggp push git - - hg -R ~/src/sand push - hg -R ~/src/sand push git - - hg -R ~/src/hype push - hg -R ~/src/hype push git - - hg -R ~/src/cl-losh push - hg -R ~/src/cl-losh push git - - hg -R ~/src/beast push - hg -R ~/src/beast push git - - hg -R ~/src/vex push - hg -R ~/src/vex push git - - hg -R ~/src/cl-digraph push - hg -R ~/src/cl-digraph push git - - hg -R ~/src/magitek push - hg -R ~/src/magitek push git - - hg -R ~/src/chancery push - hg -R ~/src/chancery push git - - hg -R ~/src/dotfiles push - - offlineimap -qf INBOX -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/edit-pasteboard.fish --- a/fish/functions/edit-pasteboard.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function edit-pasteboard - pbpaste | vipe | pbcopy -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/empty-trash.fish --- a/fish/functions/empty-trash.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function emptytrash -d "Empty the OS X trash folders" - sudo rm -rfv /Volumes/*/.Trashes - sudo rm -rfv ~/.Trash - sudo rm -rfv /private/var/log/asl/*.asl -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/fabric.fish --- a/fish/functions/fabric.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function fabric -d "fab with my SSH identity" - fab -i ~/.ssh/stevelosh $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/fcowlol.fish --- a/fish/functions/fcowlol.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function fcowlol -d "Show a fun twitch banner" --wraps "figlet" - figlet -f ogre -w9999 $argv | cowsay -W 9999 -n -p | lolcat -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/fix-open-with.fish --- a/fish/functions/fix-open-with.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -function fix-open-with -d "Fix the shitty OS X Open With menu duplicates" - /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user - killall Finder - echo "Open With has been rebuilt, Finder will relaunch" -end - - diff -r a8a82a63b876 -r 52107888f30a fish/functions/fzf-fish.fish --- a/fish/functions/fzf-fish.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -function fzf-fish - set -q FZF_FIND_FILE_COMMAND - or set -l FZF_FIND_FILE_COMMAND "ffind --semi-restricted --depth=15 --follow" - fish -c "$FZF_FIND_FILE_COMMAND" | fzf -m --height 15 | read -l selects - and commandline -i "\"$selects\"" - commandline -f repaint -end - -# https://github.com/fisherman/fzf/blob/master/key_bindings.fish diff -r a8a82a63b876 -r 52107888f30a fish/functions/gigfor.fish --- a/fish/functions/gigfor.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function gigfor - cp ~/Dropbox/tasks/gig-archive ~/Dropbox/tasks/gig.txt -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/hex.fish --- a/fish/functions/hex.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function hex -d "Open a file in Hex Fiend" - open -a Hex\ Fiend $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/hey-virtualbox-shut-down-or-i-will-fucking-cut-you.fish --- a/fish/functions/hey-virtualbox-shut-down-or-i-will-fucking-cut-you.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -function hey-virtualbox-shut-down-or-i-will-fucking-cut-you - VBoxManage controlvm $argv poweroff -end - diff -r a8a82a63b876 -r 52107888f30a fish/functions/hi.fish --- a/fish/functions/hi.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -function hi --argument pattern -d "Highlight a pattern in a stream of text" - grep -E --color=always --line-buffered "$pattern|\$" -end - diff -r a8a82a63b876 -r 52107888f30a fish/functions/isen.fish --- a/fish/functions/isen.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function isen -d "Translate from Icelandic to English" --wraps "trans" - trans -b -u firefox is:en $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/md.fish --- a/fish/functions/md.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function md -d "mkdir" --wrap "mkdir" - mkdir -p $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/oldgcc.fish --- a/fish/functions/oldgcc.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function oldgcc -d "Set \$CC to the old GCC" - set -g CC /usr/bin/gcc-4.0 -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/path_this.fish --- a/fish/functions/path_this.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function path_this -d "Add the cwd to the front of PATH" - set PATH (pwd) $PATH -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/ppj.fish --- a/fish/functions/ppj.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function ppj -d "Prettify Pasteboard JSON" - pbp | pj -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/quietly.fish --- a/fish/functions/quietly.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function quietly -d "Run a command and hide the output" - eval $argv >/dev/null ^/dev/null -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/sc.fish --- a/fish/functions/sc.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function sc -d "Launch a Scala console" - mvn scala:console $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/skim.fish --- a/fish/functions/skim.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function skim -d "Open file in Skim.app" - open -a Skim $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/spotlight-off.fish --- a/fish/functions/spotlight-off.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function spotlight-off -d "Turn off Spotlight indexing" - sudo mdutil -a -i off - and sudo mv /System/Library/CoreServices/Search.bundle/ /System/Library/CoreServices/SearchOff.bundle/ - and killall SystemUIServer -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/spotlight-on.fish --- a/fish/functions/spotlight-on.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -function spotlight-on -d "Turn on Spotlight indexing" - sudo mdutil -a -i on - and sudo mv /System/Library/CoreServices/SearchOff.bundle/ /System/Library/CoreServices/Search.bundle/ - and killall SystemUIServer -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/spotlight-tail.fish --- a/fish/functions/spotlight-tail.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function spotlight-tail -d "Watch what Spotlight is doing" - sudo fs_usage -w -f filesys mdworker | grep "open" -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/thanks.fish --- a/fish/functions/thanks.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function thanks - clear; and fcowlol 'Thanks!' -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/vp.fish --- a/fish/functions/vp.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function vp -d "Vim Pasteboard" - pbpaste | vim - -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/wo.fish --- a/fish/functions/wo.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function wo -d "workon" - workon $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/functions/ydl.fish --- a/fish/functions/ydl.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -function ydl -d "Youtube-DL" --wraps "youtube-dl" - youtube-dl $argv -end diff -r a8a82a63b876 -r 52107888f30a fish/virtualenv.fish --- a/fish/virtualenv.fish Mon Jan 14 12:30:39 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# mostly from http://coderseye.com/2010/using-virtualenv-with-fish-shell.html - -function workon -d "Activate virtual environment in $WORKON_HOME" - set tgt {$WORKON_HOME}/$argv[1] - - if [ ! -d $tgt ] - mkdir -p "$WORKON_HOME" - virtualenv $tgt - end - - if [ -d $tgt ] - cd $tgt - - deactivate - - set -gx VIRTUAL_ENV "$tgt" - set -gx _OLD_VIRTUAL_PATH $PATH - set -gx PATH "$VIRTUAL_ENV/bin" $PATH - - # unset PYTHONHOME if set - if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME - end - - cd - - echo "activated $tgt" - else - echo "$tgt not found" - end -end - -complete -c workon -a "(cd $WORKON_HOME; ls -d *)" - -function deactivate -d "Exit virtualenv and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - set -e VIRTUAL_ENV -end - diff -r a8a82a63b876 -r 52107888f30a lisp/build-binary --- a/lisp/build-binary Mon Jan 14 12:30:39 2019 -0500 +++ b/lisp/build-binary Mon Jan 14 12:31:12 2019 -0500 @@ -6,4 +6,4 @@ BINARY=$(basename "$1" .lisp) shift -sbcl --load "$LISP" --eval "(sb-ext:save-lisp-and-die \"$BINARY\" :executable t :save-runtime-options t :toplevel 'toplevel)" "$@" +sbcl --load "$LISP" --eval "(sb-ext:save-lisp-and-die \"$BINARY\" :executable t :save-runtime-options t :toplevel '$BINARY:toplevel)" "$@" diff -r a8a82a63b876 -r 52107888f30a lisp/build-manual --- a/lisp/build-manual Mon Jan 14 12:30:39 2019 -0500 +++ b/lisp/build-manual Mon Jan 14 12:31:12 2019 -0500 @@ -7,4 +7,4 @@ OUT="$NAME.1" shift -sbcl --disable-debugger --load "$LISP" --eval "(with-open-file (f \"$OUT\" :direction :output :if-exists :supersede) (adopt:print-manual *ui* :stream f))" --quit "$@" +sbcl --disable-debugger --load "$LISP" --eval "(with-open-file (f \"$OUT\" :direction :output :if-exists :supersede) (adopt:print-manual $NAME:*ui* :stream f))" --quit "$@" diff -r a8a82a63b876 -r 52107888f30a lisp/clhs.lisp --- a/lisp/clhs.lisp Mon Jan 14 12:30:39 2019 -0500 +++ b/lisp/clhs.lisp Mon Jan 14 12:31:12 2019 -0500 @@ -4,6 +4,12 @@ (ql:quickload '(:adopt :drakma :plump :clss :alexandria) :silent t)) +(defpackage :clhs + (:use :cl) + (:export :toplevel :*ui*)) + +(in-package :clhs) + ;;;; Config ------------------------------------------------------------------- (defparameter *default-hyperspec-url* "http://www.lispworks.com/documentation/HyperSpec/") diff -r a8a82a63b876 -r 52107888f30a lisp/example.lisp --- a/lisp/example.lisp Mon Jan 14 12:30:39 2019 -0500 +++ b/lisp/example.lisp Mon Jan 14 12:31:12 2019 -0500 @@ -1,6 +1,12 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload '(:adopt) :silent t)) +(defpackage :example + (:use :cl) + (:export :toplevel :*ui*)) + +(in-package :example) + ;;;; Config ------------------------------------------------------------------- (defparameter *default-name* "World") diff -r a8a82a63b876 -r 52107888f30a lisp/genpass.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/genpass.lisp Mon Jan 14 12:31:12 2019 -0500 @@ -0,0 +1,169 @@ +(eval-when (:compile-toplevel :load-toplevel :execute) + (ql:quickload '(:adopt :series :iterate :str) :silent t)) + +(defpackage :genpass + (:use :cl :iterate) + (:export :toplevel :*ui*)) + +(in-package :genpass) + +;;;; Functionality ------------------------------------------------------------ +(defparameter *passphrase-sep* " ") +(defparameter *words* nil) + +(defmacro -<> (value &body forms) + (reduce (lambda (val expression) + (subst val '<> expression)) + forms + :initial-value value)) + +(defun safep (char) + (or (char<= #\a char #\z) + (char<= #\A char #\Z) + (char<= #\0 char #\9))) + +(defun word-list () + (unless *words* + (setf *words* + (iterate + (for line :in-file "/usr/share/dict/words" :using #'read-line) + (when (every #'safep line) + (collect line :result-type vector))))) + *words*) + +(defun random-unsigned-byte-32 () + (with-open-file (urandom "/dev/urandom" :element-type '(unsigned-byte 8)) + (logior (ash (read-byte urandom) 0) + (ash (read-byte urandom) 8) + (ash (read-byte urandom) 16) + (ash (read-byte urandom) 24)))) + +(defun urandom (limit) + (check-type limit (integer 0 (#.(expt 2 32)))) + (iterate + (with threshold = (mod (expt 2 32) limit)) + (for candidate = (random-unsigned-byte-32)) + (finding (mod candidate limit) :such-that (>= candidate threshold)))) + +(defun random-elt (sequence) + (elt sequence (urandom (length sequence)))) + +(defun random-words (n) + (iterate + (with words = (word-list)) + (repeat n) + (collect (random-elt words)))) + +(defun random-sentence% (words) + (str:join *passphrase-sep* (mapcar #'string-capitalize (random-words words)))) + +(defun random-sentence (words length) + (iterate + (for candidate = (random-sentence% words)) + (finding candidate :such-that (<= (length candidate) length)))) + +(defun random-garbage (length) + (with-open-file (urandom "/dev/urandom" :element-type '(unsigned-byte 8)) + (-<> urandom + (series:scan-stream <> #'read-byte) + (series:map-fn t #'code-char <>) + (series:choose-if #'safep <>) + (series:subseries <> 0 length) + (series:collect 'string <>)))) + +(defun random-smart (words length) + (check-type words (integer 1)) + (format nil "~A~A~D" + (random-sentence words (- length 1 (length *passphrase-sep*))) + *passphrase-sep* + (urandom 10))) + + +;;;; Run ---------------------------------------------------------------------- +(defun run (length words smart smush?) + (let ((*passphrase-sep* (if smush? "" " "))) + (write-string + (cond + ((zerop words) (random-garbage length)) + (smart (random-smart words length)) + (t (random-sentence words length)))))) + + +;;;; User Interface ----------------------------------------------------------- +(adopt:define-string *documentation* + "Generate a random password.") + +(defparameter *examples* + '(("Generate a random passphrase no longer than 24 characters:" + . "genpass --length 24") + ("Generate a more random, harder to type password:" + . "genpass --no-words") + ("Generate a six word passphrase with no spaces:" + . "genpass --words 6 --smush"))) + +(adopt:define-interface *ui* + (:name "genpass" + :usage "[OPTIONS]" + :summary "Generate a random password." + :documentation *documentation* + :examples *examples*) + ((help) + :documentation "Display help and exit." + :long "help" + :short #\h + :reduce (constantly t)) + ((length) + :documentation "Ensure password is no longer than N characters (default 40)." + :long "length" + :short #\l + :parameter "N" + :initial-value 40 + :reduce #'adopt:newest + :key #'parse-integer) + ((words) + :documentation "If non-zero, generate passphrases of N words instead of opaque strings (default 4)." + :long "words" + :short #\w + :parameter "N" + :initial-value 4 + :reduce #'adopt:newest + :key #'parse-integer) + ((no-words words) + :documentation "Shorthand for --words=0." + :long "no-words" + :short #\W + :reduce (constantly 0)) + ((smart) + :documentation "Smart mode (the default). Generate as with --words, but add a number on the end to satisfy the red tape on many sites." + :long "smart" + :short #\s + :initial-value t + :reduce (constantly t)) + ((no-smart smart) + :documentation "Turn off smart mode." + :long "no-smart" + :short #\S + :reduce (constantly nil)) + ((smush) + :documentation "Don't include spaces in passphrases." + :long "smush" + :short #\m + :reduce (constantly t)) + ((no-smush smush) + :documentation "Include spaces in passphrases (the default)." + :long "no-smush" + :short #\M + :reduce (constantly nil))) + +(defun toplevel () + (handler-case + (multiple-value-bind (arguments options) (adopt:parse-options *ui*) + (when (gethash 'help options) + (adopt:print-usage-and-exit *ui*)) + (when arguments + (error "Unrecognized command line arguments: ~S" arguments)) + (run (gethash 'length options) + (gethash 'words options) + (gethash 'smart options) + (gethash 'smush options))) + (error (c) (adopt:print-error-and-exit c)))) diff -r a8a82a63b876 -r 52107888f30a lisp/lispindent.lisp --- a/lisp/lispindent.lisp Mon Jan 14 12:30:39 2019 -0500 +++ b/lisp/lispindent.lisp Mon Jan 14 12:31:12 2019 -0500 @@ -4,6 +4,12 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload '(:adopt) :silent t)) +(defpackage :lispindent + (:use :cl) + (:export :toplevel :*ui*)) + +(in-package :lispindent) + ;Dorai Sitaram ;Oct 8, 1999 diff -r a8a82a63b876 -r 52107888f30a lisp/search.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/search.lisp Mon Jan 14 12:31:12 2019 -0500 @@ -0,0 +1,92 @@ +(eval-when (:compile-toplevel :load-toplevel :execute) + (ql:quickload '(:adopt :cl-ppcre) :silent t)) + +(defpackage :search + (:use :cl) + (:export :toplevel :*ui*)) + +(in-package :search) + +;;;; Functionality ------------------------------------------------------------ +(defun make-scanner (pattern &key literal) + (let ((ppcre:*use-bmh-matchers* t) + (ppcre:*optimize-char-classes* :charmap) + (ppcre:*regex-char-code-limit* 128)) + (ppcre:create-scanner (if literal + `(:sequence ,pattern) + (ppcre:parse-string pattern))))) + +(defun search-stream (scanner stream &key invert) + (loop + :for line = (read-line stream nil nil nil) + :while line + :when (eq invert (not (ppcre:scan scanner line))) + :do (write-line line))) + +(defun search-file (scanner path &key invert) + (with-open-file (stream path :external-format '(:ascii :replacement #\?)) + (search-stream scanner stream :invert invert))) + +(defun run (pattern paths &key literal invert) + (loop + :with scanner = (make-scanner pattern :literal literal) + :for path :in paths + :do (if (string= "-" path) + (search-stream scanner *standard-input* :invert invert) + (search-file scanner path :invert invert)))) + + +;;;; CLI ---------------------------------------------------------------------- +(adopt:define-string *documentation* + "A simple reimplementation of grep in Common Lisp. FILEs will be searched ~ + for lines that match PATTERN and matching lines will be printed.~@ + ~@ + Perl-compatible regular expressions are supported.~@ + ~@ + If no FILEs are given, standard input will be searched. Standard input can ~ + also be searched by specifying - as a filename.") + +(adopt:define-interface *ui* + (:name "search" + :usage "PATTERN [FILE...]" + :summary "Print lines that match a regular expression." + :documentation *documentation*) + (help + :documentation "display help and exit" + :long "help" + :short #\h + :reduce (constantly t)) + (literal + :documentation "treat PATTERN as a literal string instead of a regex" + :long "literal" + :short #\l + :reduce (constantly t)) + ((no-literal literal) + :documentation "treat PATTERN as a regex (the default)" + :long "no-literal" + :short #\L + :reduce (constantly nil)) + (invert + :documentation "print non-matching lines" + :long "invert" + :short #\v + :initial-value nil + :reduce (constantly t)) + ((no-invert invert) + :documentation "print matching lines (the default)" + :long "no-invert" + :short #\V + :reduce (constantly nil))) + +(defun toplevel () + (handler-case + (multiple-value-bind (arguments options) (adopt:parse-options *ui*) + (when (gethash 'help options) + (adopt:print-usage-and-exit *ui*)) + (when (null arguments) + (error "PATTERN is required")) + (destructuring-bind (pattern . paths) arguments + (run pattern (or paths (list "-")) + :literal (gethash 'literal options) + :invert (gethash 'invert options)))) + (error (c) (adopt:print-error-and-exit c)))) diff -r a8a82a63b876 -r 52107888f30a man/man1/brows.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/man/man1/brows.1 Mon Jan 14 12:31:12 2019 -0500 @@ -0,0 +1,1 @@ +/home/sjl/src/brows/bin/brows.1 \ No newline at end of file diff -r a8a82a63b876 -r 52107888f30a man/man1/cacl.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/man/man1/cacl.1 Mon Jan 14 12:31:12 2019 -0500 @@ -0,0 +1,1 @@ +/home/sjl/src/cacl/build/cacl.1 \ No newline at end of file diff -r a8a82a63b876 -r 52107888f30a restic/excludes.txt --- a/restic/excludes.txt Mon Jan 14 12:30:39 2019 -0500 +++ b/restic/excludes.txt Mon Jan 14 12:31:12 2019 -0500 @@ -6,7 +6,13 @@ /home/sjl/.mozilla /home/sjl/.dropbox /home/sjl/.steam +/home/sjl/.quicklisp +/home/sjl/.virtualenvs /home/sjl/.local/share +/home/sjl/.local/lib/python* /home/sjl/.config/chromium +/home/sjl/.config/libreoffice +/home/sjl/.config/discord +/home/sjl/.dropbox-dist /home/sjl/Dropbox/.dropbox.cache diff -r a8a82a63b876 -r 52107888f30a stumpwmrc --- a/stumpwmrc Mon Jan 14 12:30:39 2019 -0500 +++ b/stumpwmrc Mon Jan 14 12:31:12 2019 -0500 @@ -14,6 +14,7 @@ *input-window-gravity* :center *debug-level* 0 *resize-increment* 75 + *new-frame-action* :empty *window-format* "(%n%m%20t)" *window-name-source* :title *shell-program* "/bin/bash") diff -r a8a82a63b876 -r 52107888f30a vim/custom-dictionary.utf-8.add --- a/vim/custom-dictionary.utf-8.add Mon Jan 14 12:30:39 2019 -0500 +++ b/vim/custom-dictionary.utf-8.add Mon Jan 14 12:31:12 2019 -0500 @@ -272,3 +272,5 @@ healthchecks Nginx architecting +CACL +shaders diff -r a8a82a63b876 -r 52107888f30a vim/vimrc --- a/vim/vimrc Mon Jan 14 12:30:39 2019 -0500 +++ b/vim/vimrc Mon Jan 14 12:31:12 2019 -0500 @@ -2637,7 +2637,7 @@ " Keys for Lisp files au FileType lisp nnoremap e :call vlime#plugin#Compile(vlime#ui#CurTopExpr(v:true)) - au FileType lisp nnoremap f :call vlime#plugin#CompileFile(expand("%:p")) + au FileType lisp nnoremap f :w:call vlime#plugin#CompileFile(expand("%:p")) au FileType lisp nnoremap S :call vlime#plugin#SendToREPL(vlime#ui#CurTopExpr()) au FileType lisp nnoremap i :call vlime#plugin#Inspect(vlime#ui#CurExprOrAtom()) au FileType lisp nnoremap I :call vlime#plugin#Inspect() @@ -2652,6 +2652,10 @@ " Keys for the Inspector au FileType vlime_inspector nnoremap <2-LeftMouse> :call vlime#ui#inspector#InspectorSelect() + " Keys for the Preview + au FileType vlime_preview nnoremap p :call vlime#plugin#SetPackage() + au FileType vlime_preview nnoremap m1 :call vlime#plugin#ExpandMacro(vlime#ui#CurExpr(), "one") + " Universal keys, for all kinds of Vlime windows au FileType lisp,vlime_repl,vlime_inspector,vlime_sldb,vlime_notes,vlime_xref,vlime_preview call MapVlimeKeys() diff -r a8a82a63b876 -r 52107888f30a w3m-keymap --- a/w3m-keymap Mon Jan 14 12:30:39 2019 -0500 +++ b/w3m-keymap Mon Jan 14 12:31:12 2019 -0500 @@ -1,2 +1,4 @@ keymap q EXIT keymap K EXIT +keymap H PREV_PAGE +keymap L NEXT_PAGE diff -r a8a82a63b876 -r 52107888f30a weechat/exec.conf diff -r a8a82a63b876 -r 52107888f30a weechat/relay.conf