Skip to content

Instantly share code, notes, and snippets.

@fredrikhl
fredrikhl / caffeine-ng-setup.bash
Last active Sep 16, 2020
caffeine-ng in a virtualenv
View caffeine-ng-setup.bash
#!/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
View tabcenter-redux.css
/* hide new tab button */
#newtab {
display: none;
}
/* hide scrollbar */
.tab {
max-width: 100vw;
}
View .Xresources
! 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
View saml-decode.py
#!/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
@fredrikhl
fredrikhl / file_overload.py
Created Aug 6, 2014
Ansible lookup plugin for locating alternative/overload files
View file_overload.py
#!/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.
@fredrikhl
fredrikhl / git-branch-cleanup
Last active Aug 29, 2015
Delete branches with no upstream
View git-branch-cleanup
#!/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 / git-branch-status
Last active Aug 29, 2015 — forked from jehiah/git-branch-status
git branch-status command
View git-branch-status
#!/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 / pyrc.py
Last active Aug 29, 2015
pyrc-autocomplete
View pyrc.py
#!/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 / prepare-commit-msg
Last active Aug 29, 2015
Cerebrum commit msg hook
View prepare-commit-msg
#!/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
View keybase.md

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:

You can’t perform that action at this time.