Skip to content

Instantly share code, notes, and snippets.

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

Bart Trojanowski bartman

🏋️‍♀️
🥩☕
View GitHub Profile
@bartman
bartman / xusbdfwu.rules
Created April 19, 2012 14:06
udev rules for xilinx usb attached jtags
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"
#!/bin/bash
set -e
base=$(dirname $0)
LSUSB=/usr/sbin/lsusb
FXLOAD=/sbin/fxload
declare -a rules=(
03fd:0007,03fd:0008,$base/xusbdfwu.hex
@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
@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 / 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
" 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
#!/bin/zsh
# (c) 2010 Bart Trojanowski <[email protected]>
set -e
DSThost="mail.jukie.net"
DSTpath="public_html/tmp/"
DSTurl="http://$DSThost/~$(id -u -n)/${DSTpath#public_html/}"
#!/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")
@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):
#!/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