Skip to content

Instantly share code, notes, and snippets.

View abraithwaite's full-sized avatar
:shipit:
:(){ :|:& };:

Alan Braithwaite abraithwaite

:shipit:
:(){ :|:& };:
View GitHub Profile
@abraithwaite
abraithwaite / build.sh
Created August 8, 2014 03:30
Deterministic Linux Builds
#!/bin/bash
export INSTALL_MOD_STRIP=-s
export KBUILD_BUILD_TIMESTAMP=0
export KBUILD_BUILD_USER=root
export KBUILD_BUILD_HOST=localhost
make mrproper
make allnoconfig
make -j4
@abraithwaite
abraithwaite / PKGBUILD
Created August 14, 2014 07:24
mutt pkgbuild
# $Id$
# Contributor: tobias [tobias [at] archlinux.org]
# Maintainer: Gaetan Bisson <[email protected]>
pkgname=mutt
pkgver=1.5.23
pkgrel=1
pkgdesc='Small but very powerful text-based mail client'
url='http://www.mutt.org/'
license=('GPL')
class A(object):
if windows:
def do_things(self):
# It's windows so this is a hack
return True
else:
def do_things(self):
# Not such a hack
return True
@abraithwaite
abraithwaite / git-fat.patch
Created September 25, 2014 03:36
Fix the index-filter command
diff --git a/home/abraithwaite/.virtualenvs/gitfat/bin/git-fat b/home/abraithwaite/git-fat
index d459746..7838567 100755
--- a/home/abraithwaite/.virtualenvs/gitfat/bin/git-fat
+++ b/home/abraithwaite/git-fat
@@ -619,10 +619,9 @@ class GitFat(object):
# Add lines to the .gitattributes file
new_ga = old_ga + ['{0} filter=fat -text'.format(f) for f in newfiles]
stdout, _ = ga_hashobj.communicate('\n'.join(new_ga) + '\n')
- self._update_index(ga_mode, stdout.strip(), ga_stno, '.gitattributes')
return ga_mode, stdout.strip(), ga_stno, '.gitattributes'
@abraithwaite
abraithwaite / bind.sls
Created October 26, 2014 23:03
Bind Zone File in Saltstack
/etc/bind/db.salt.example.com:
file.managed:
- source: salt://templates/db.salt.example.com.pyt
- template: jinja
- user: root
- group: bind
- mode: 644
bind_reload:
service.running:
@abraithwaite
abraithwaite / parse_file.py
Last active August 29, 2015 14:10
Parse arbitrary key:value file.
identifiers = ["IP Address", "Vlan", "Subnet Mask"] # etc. Define what you want to grab here
def parse_line(line):
# the second argument means only take the first split. e.g. "a:b:c" becomes "a", "b:c"
key, value = line.split(":", 1)
# if the identifier is one we care about
if key in identifiers:
return key, value
return None, None
@abraithwaite
abraithwaite / global_syscalls.lua
Last active August 29, 2015 14:15
Counts syscalls for all processes
-- Chisel description
description = "counts how many times the specified system call has been called for every process"
short_description = "syscall count"
category = "misc"
args = {}
-- Initialization callback
function on_init()
-- Request the fileds that we need
@abraithwaite
abraithwaite / dmesg.txt
Created March 22, 2015 03:40
novena dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.17.0-rc5-00238-gfb115dd (xobs@xobs-novena-laptop) (gcc version 4.9.1 (Debian 4.9.1-19) ) #350 SMP PREEMPT Fri Dec 12 18:08:43 SGT 2014
[ 0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Kosagi Novena Dual/Quad
[ 0.000000] Ignoring memory range 0xffffffff - 0x100000000
[ 0.000000] cma: Reserved 256 MiB at 2f800000
@abraithwaite
abraithwaite / log.txt
Created April 9, 2015 04:23
Let's Git Racy
abraithwaite@jessie qwer]$ cat asdf.zip
version https://git-lfs.github.com/spec/v1
oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
size 0
[abraithwaite@jessie qwer]$ git status
On branch qwer
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
@abraithwaite
abraithwaite / git-read-branch
Created January 8, 2016 22:30
When you're too lazy to switch branches to read that file.
#!/bin/sh
git ls-tree -r $1 | grep $2 | awk '{print $3}' | xargs git cat-file blob