Skip to content

Instantly share code, notes, and snippets.

@jb55
jb55 / pdfnow
Last active November 25, 2019 16:47
#!/usr/bin/env bash
PANDOC="pandoc --variable urlcolor=cyan"
usage () {
printf "usage: pdfnow file.md OR <file.md pdfnow markdown\n" >&2
exit 1
}
[ $# -eq 0 ] && usage
#!/usr/bin/env bash
howlong() {
mins=$(($1 * 10))
target=$(date -u -d "now + $mins minutes" -Iseconds)
targetp=$(date -d $target '+%F %R %Z')
ddiff=$(datediff -f "%dd %Hh %0Mm @ $targetp" "now" "$target")
printf "%s\n" "$ddiff"
}
@jb55
jb55 / fees.sh
Last active October 23, 2017 16:29
#!/usr/bin/env bash
getprice () {
# replace with your preferred exchange
curl -sL 'https://api.quadrigacx.com/v2/ticker' | jq -r .last
}
n=${1:-100}
size=${2:-226}
price=${3:-$(getprice)}
@jb55
jb55 / enum.h
Last active October 22, 2017 08:33
enum opcode_token
{
// push value
_OP_0=1,
_OP_FALSE,
_OP_PUSHDATA1,
_OP_PUSHDATA2,
_OP_PUSHDATA4,
_OP_1NEGATE,
_OP_RESERVED,
#!/usr/bin/env bash
set -e
access_token=$GITHUB_ACCESS_TOKEN
api() {
curl -sL -H "Authorization: token $access_token" "$@"
}
function k(c){var i=0;window.addEventListener('keyup',(e)=>{var y=e.keycode;[38,38,40,40,37,39,37,39,66,65,13][i]==y?i==9?c():i++:i=y==38?1:0})}

make flags passed to `git am` configurable

See functions using git am

`zz` bindings for show mode, how to do that?

Don’t use capitalized bindings in notmuch-show [0/2]

As described in notmuch:id:87tvz8419r.fsf@jb55.com

Conflicts with search bindings:

type instance Element StoreFile = FilePath
type instance Element MatchFile = FilePath
type instance Element AppleMusicFile = FilePath
newtype StoreFile = StoreFile { unStoreFile :: FilePath }
deriving Show
newtype MatchFile = MatchFile { unMatchFile :: FilePath }
deriving Show
sequential :: [Int] -> Bool
sequential = all (==True) (zipWith beside xs (tail xs))
where
beside n1 n2 = abs (n2 - n1) == 1
{-
λ> sequential [1,2,3]
True
λ> sequential [3,2,1]
#!/usr/bin/env bash
set -e
get_mimetype(){
file --mime-type "$1" | sed 's/.*: //'
}
usage () {
printf "kindle-email <file.pdf>\n" 1>&2