Skip to content

Instantly share code, notes, and snippets.

@fredrikhl
fredrikhl / keybase.md
Created April 25, 2014 08:55
Keybase proof

Keybase proof

I hereby claim:

  • I am fredrikhl on github.
  • I am fredrikhl (https://keybase.io/fredrikhl) on keybase.
  • I have a public key whose fingerprint is 60A6 531E AA44 E6B2 DEFA F6F8 D2BC 0F60 D378 7168

To claim this, I am signing this object:

@fredrikhl
fredrikhl / prepare-commit-msg
Last active August 29, 2015 14:00
Cerebrum commit msg hook
#!/bin/sh
#
# branch -> remove /path/to/branch
tag=$( git symbolic-ref HEAD \
| awk -F'/' '{print $NF}' \
| sed 's/^[Cc][Rr][Bb]-\([0-9]\+\)/CRB-\1/' \
)
[ -n "$tag" ] && echo "$tag" >> $1
@fredrikhl
fredrikhl / pyrc.py
Last active August 29, 2015 14:01
pyrc-autocomplete
#!/usr/bin/env python
#
"""Python startup script."""
class IndentOrCompleteMixin(object):
u""" Mixin to add tab completion for inserting indents.
The idea is that a (base10) natural number (e.g. 3, 45) has no sensible
@fredrikhl
fredrikhl / git-branch-status
Last active August 29, 2015 14:01 — forked from jehiah/git-branch-status
git branch-status command
#!/bin/bash
#
# From: http://github.com/jehiah
#
# Usage: Run `git-branch-status.sh' in a git repository
# OR `git branch-status' if the script is in your ${PATH}
#
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
while read local remote
do
@fredrikhl
fredrikhl / git-branch-cleanup
Last active August 29, 2015 14:02
Delete branches with no upstream
#!/bin/bash
#
# Usage: Run `git-branch-cleanup.sh' in a git repository
# OR `git branch-cleanup' if the script is in your ${PATH}
#
# git_branch_delete
#
# Delete a given branch if not the current branch
@fredrikhl
fredrikhl / file_overload.py
Created August 6, 2014 13:45
Ansible lookup plugin for locating alternative/overload files
#!/usr/bin/env python
#
# To use this lookup plugin in a project:
# - Put script in a subfolder of your ansible project
# - Add to your project config: lookup_plugins = ./path/to/subfolder
#
""" Ansible lookup plugin.
This Ansible lookup plugin looks up files or templates for a role.
#!/usr/bin/env python2
# encoding: utf-8
u""" Decode and pretty-print a SAML HTTP-Redirect message """
import zlib
import base64
import urlparse
import hashlib
# Conditional imports: M2Crypto, xml.dom.minidom, argparse, sys
/* hide new tab button */
#newtab {
display: none;
}
/* hide scrollbar */
.tab {
max-width: 100vw;
}
! Xterm settings
!
xterm*font: -misc-fixed-medium-*-*-*-12-110*-*-*-*-*-iso10646-1
xterm*boldFont: -misc-fixed-medium-*-*-*-12-110*-*-*-*-*-iso10646-1
xterm*faceName: Liberation Mono:size=8:antialias=true
xterm*renderFont: false
xterm*allowBoldFonts: false
xterm*boldMode: false
@fredrikhl
fredrikhl / caffeine-ng-setup.bash
Last active September 16, 2020 11:51
caffeine-ng in a virtualenv
#!/usr/bin/env bash
#
# Install/update caffeine-ng in a virtualenv
#
CAFFEINE_ENV="${HOME}/.local/env/caffeine-ng"
set -x
set -e
# Install/update caffeine-ng