Skip to content

Instantly share code, notes, and snippets.

View bartman's full-sized avatar
🏋️‍♀️
🥩☕

Bart Trojanowski bartman

🏋️‍♀️
🥩☕
View GitHub Profile
# ./dhcpdump -i eth2
TIME: 2009-12-03 15:17:54.533
IP: 10.10.10.171 (0:1e:68:57:46:88) > 10.10.10.254 (0:d:b9:2:5b:ea)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 1
XID: d6d4ad65
SECS: 0
in /etc/network/interfaces ...
#auto wlan0
allow-hotplug wlan0
mapping wlan0
script /etc/network/which-wlan0
# the which-wlan0
map essid=air.jukie.net key=on wifi-air
map essid=xjukie.net \
ap=00:14:BF:AF:98:30 \
#!/usr/bin/make -f
# find all git repos and run gc in them
# options:
# DEPTH=<number> pass to find
# DIR=<path> where to look
# NICE=<lvl> nice level (-20..19)
# IONICE=<lvl> ionice level (0..7)
#
# Why a makefile? so you can pass it a -j
@bartman
bartman / 256.py -d
Created February 25, 2010 16:26
256.py
#!/usr/bin/python
import sys
BASIC_SIZE = 16
CUBE_SIZE = 6
GRAY_SIZE = 24
NUMBERS = 0
def rgb(corner, axis, x, y, z):
#!/bin/bash
URLS=$@
related_urls() {
w3m -dump_source 'http://www.youtube.com/watch?v=NS2xpf5O8nQ' 2>|/dev/null | sed -n -e 's,.*href="\(/watch.v=[^"]*\)&amp;feature=related".*,http://www.youtube.com\1,p'
}
if [ "$1" = "--related" ] ; then
URLS=$(related_urls "$2")
#!/bin/zsh
# (c) 2010 Bart Trojanowski <bart@jukie.net>
set -e
DSThost="mail.jukie.net"
DSTpath="public_html/tmp/"
DSTurl="http://$DSThost/~$(id -u -n)/${DSTpath#public_html/}"
" strip spaces at the end of a line (almost working version)
function! ReturnStrip()
let p=getpos('.')
:s/\s\+$//e
exe ':s/\s\+\%' . p[2] . 'c//e'
call setpos('.', p)
normal! a^M
" ^^^ that's supposed to be a ^V<CR>
endfunction
imap <CR> <ESC>:call ReturnStrip()<CR>a
@bartman
bartman / ip6tables
Created November 3, 2010 13:46
simple ipv6 stateful firewall setup
$ cat /etc/network/if-pre-up.d/iptables
#!/bin/sh
for ip in ip ip6 ; do
if [ -f /etc/default/${ip}tables ] ; then
${ip}tables-restore < /etc/default/${ip}tables
fi
done
$ cat /etc/default/ip6tables
# Generated by iptables-save v1.4.4 on Tue Oct 27 10:11:58 2009
@bartman
bartman / test.c
Created September 15, 2011 14:38
gcc bitfields
#include <stdio.h>
#include <stdint.h>
#define STRINGIFY_ARG(contents) #contents
int main(void)
{
union {
uint32_t word;
@bartman
bartman / gist:1731737
Created February 3, 2012 18:54
git merge no longer fast forwards
I am using git version 1.7.9, built by me from git on Debian/testing.
I am on the Linux-2.5-stable tree.
Ie: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
I just fetched after GregKH posted v3.2.3 was out.
$ git describe
v3.2.2
$ git merge-base v3.2.2 v3.2.3 | xargs git describe