Skip to content

Instantly share code, notes, and snippets.

View emlun's full-sized avatar

Emil Lundberg emlun

View GitHub Profile
@emlun
emlun / .bash_alias
Last active February 3, 2016 11:20
Bare minimum Bash settings
alias ls="ls -h --color=auto"
alias ll="ls -lh"
alias la="ls -lah"
#!/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)
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) {
#!/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 June 22, 2016 08:08
Git config
[core]
autocrlf = input
editor = vim
[push]
default = simple
[color]
ui = true
@emlun
emlun / two-combinations.clj
Last active April 9, 2017 13:51
two-combinations
(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 June 4, 2017 21:00
GRand Unified Storage system
#!/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())
@emlun
emlun / c173434232651982.lua
Last active September 9, 2017 19:48
Shenzhen I/O: Frobnicator
-- The function get_name() should return a single string that is the name of the puzzle.
--
function get_name()
return "Frobnicator"
end
-- The function get_description() should return an array of strings, where each string is
-- a line of description for the puzzle. Surrounding text with asterisks will cause it to
-- be rendered in bold, something we use when mentioning a signal by name.
--
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script>
const ykNanoCredentialId = new Uint8Array([
177, 125, 44, 11, 125, 20, 124, 221, 117, 42, 171, 163, 91, 125, 150, 85,
217, 150, 76, 209, 3, 91, 109, 115, 21, 100, 42, 36, 107, 73, 20, 120,