Skip to content

Instantly share code, notes, and snippets.

Avatar

Emil Lundberg emlun

View GitHub Profile
View keybase-prove.sh
#!/bin/bash
# Utility script for making it easier to sign stuff for Keybase.io with an
# airgapped offline key.
#
# Usage:
# 1. Set the `REMOVABLE_DEVICE_UUID` below (see `$ lsblk -o +FSTYPE,UUID`)
# 2. Go to keybase.io and add a new key or proof, track someone etc.
# 3. Choose to sign manually
# 4. Copy the script to the Xorg primary clipboard (should be enough to just
# select it all - triple-clicking the text box does the trick in Firefox)
View confgit.sh
#!/bin/bash
# Author: Emil Lundberg <lundberg.emil@gmail.com> <https://keybase.io/emlun>
#
# This is free and unencumbered software released into the public domain.
# See http://unlicense.org/ for the full license.
#
# Usage:
#
# $ confgit ls # List git repositories in ~/.config/
# $ confgit foo init # Clone 'foo.git' from remote into ~/.config/foo/
@emlun
emlun / gitalias
Last active Aug 29, 2015
My git alias configuration
View gitalias
# This is free and unencumbered text released into the public domain.
# For more information, please refer to <http://unlicense.org/>
[alias]
a = add -up
aa = !yes a | git a
amend = commit --amend -C HEAD
d = diff
di = diff --ignore-all-space
@emlun
emlun / .bash_alias
Last active Feb 3, 2016
Bare minimum Bash settings
View .bash_alias
alias ls="ls -h --color=auto"
alias ll="ls -lh"
alias la="ls -lah"
View merge.js
var _ = require('underscore');
var list1 = [{ id: 0, a: 'a0', b: 'b0' }, { id: 1, a: 'a1', c: 'c1' }];
var list2 = [{ id: 0, c: 'c0', d: 'd0' }, { id: 1, a: 'A1', b: 'b1' }];
var merged = _(list1).chain()
.concat(list2)
.groupBy('id')
.map(function(group, id) {
return _(group).reduce(function(result, next) {
View clean-password-store-sync-conflicts.sh
#!/bin/bash
# Clean out Syncthing *.sync-conflict-* files from Password Store
#
# Usage: Run the script from anywhere with no parameters.
#
# The script will remove all conflict files in `~/.password-store` for which
# the plaintext contents of the original file and the conflict file have the
# same SHA256 checksum. I.e. if `foo.sync-conflict-20151115-205258.gpg` and
# `foo.gpg` have the same checksums after decrypting, then the former will be
# removed.
@emlun
emlun / .gitconfig
Last active Jun 22, 2016
Git config
View .gitconfig
[core]
autocrlf = input
editor = vim
[push]
default = simple
[color]
ui = true
@emlun
emlun / two-combinations.clj
Last active Apr 9, 2017
two-combinations
View two-combinations.clj
(defn pair-with-all-in
{ :test #(let [f pair-with-all-in]
(is (= [] (f 0 [])))
(is (= [ [0 1] ] (f 0 [1])))
(is (= [ [0 1] [0 2] ] (f 0 [1 2])))
)
}
[ x ys ]
(map (fn [y] [x y]) ys))
@emlun
emlun / README.md
Last active Jun 4, 2017
GRand Unified Storage system
View README.md
View example-signatures.py
#!/usr/bin/python3
from binascii import hexlify, unhexlify
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
sig_alg = ec.ECDSA(hashes.SHA256())
You can’t perform that action at this time.