Skip to content

Instantly share code, notes, and snippets.

View bartman's full-sized avatar
🤓
🏋️‍♂️🥩☕💻ⓒ🦀

Bart Trojanowski bartman

🤓
🏋️‍♂️🥩☕💻ⓒ🦀
View GitHub Profile
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key v split-window -h
bind-key b split-window
# detach
@bartman
bartman / gitconfig
Created December 12, 2012 19:15
git new-feature <branch> [ <remote> ]
[alias]
# create a new feature branch on the same remote as current branch
new-feature = "!f() { local feature=$1 remote=$2 base=$3 ; \
if [[ -z $feature ]] ; then \
echo >&2 \"git new-feature <branch> [ <remote> ] \" ; \
return 1 ; \
fi ; \
if [[ -z $remote ]] ; then \
local cur=$( git rev-parse --revs-only --symbolic-full-name HEAD ) ; \
cur=${cur#refs/heads/} ; \
@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")