Skip to content

Instantly share code, notes, and snippets.

@ion1
ion1 / record
Created March 27, 2010 15:02
Scripts from my screencast workflow
#!/bin/sh
set -e
x=200
y=100
w=768
h=432
cd "$(dirname "$0")"
@ion1
ion1 / xorg.conf
Created April 2, 2010 19:14
My xorg.conf with Wacom calibration
Section "InputClass"
MatchProduct "Wacom"
MatchIsTablet "true"
Identifier "Tablet"
Driver "wacom"
Option "TPCButton" "on"
Option "TopX" "150"
Option "BottomX" "26200"
Option "TopY" "225"
Option "BottomY" "16375"
@ion1
ion1 / play-unheard
Created April 4, 2010 18:38
Play unheard songs in xmms2 chronologically
#!/bin/sh
set -e
nyxmms2 stop
nyxmms2 clear
nyxmms2 add 'timesplayed<1'
nyxmms2 playlist sort date album album_id tracknr
nyxmms2 jump 1
nyxmms2 play
@ion1
ion1 / ntp.erl
Created April 12, 2010 10:17
Parsing IPv4/UDP/NTP packets in Erlang
parse_ip (Packet) ->
case Packet of
<<4:4, HeaderLength:4, _DiffServ:8, _Length:16, _Identification:16,
_Flags:3, _FragOffset:13, _TTL:8, Protocol:8, _HeaderChecksum:16,
SrcAddr:32/bits, DstAddr:32/bits, OptionsAndData/bytes>>
->
OptionsLength = HeaderLength*32-160,
<<_Options:OptionsLength, Data/bytes>> = OptionsAndData,
case Protocol of
@ion1
ion1 / xorg.conf
Created April 16, 2010 19:31
xorg.conf for A’s laptop
Section "Device"
Identifier "Device 0"
Driver "trident"
EndSection
Section "Monitor"
Identifier "Monitor 0"
HorizSync 31.5-48.0
VertRefresh 56.0-65.0
EndSection
@ion1
ion1 / rtorrent.rc
Created April 22, 2010 20:40
rtorrent.rc
# http://libtorrent.rakshasa.no/wiki/RTorrentRatioHandling
ratio.enable =
ratio.min.set = 200
ratio.max.set = 0
ratio.upload.set = 0
system.method.set = group.seeding.ratio.command, d.close=, d.erase=
# Link when finished.
system.method.set_key = event.download.finished, link_finished, "execute = mkdir, -p, ../done; execute = cp, -al, --, $d.get_base_path=, ../done/"
@ion1
ion1 / interactivezoo.eu-cameras
Created April 30, 2010 12:00
Overengineer much?
#!/usr/bin/env ruby
require 'rubygems'
require 'cgi'
require 'erubis'
require 'iconv'
require 'logger'
require 'mechanize'
require 'ostruct'
@ion1
ion1 / gist:417494
Created May 28, 2010 18:04
Start empathy on login
(sed -re '/^Exec=/s/$/ --start-hidden/' /usr/share/applications/empathy.desktop; printf 'OnlyShowIn=GNOME;\nAutostartCondition=GNOME /apps/empathy/autoconnect\nX-GNOME-Autostart-Delay=30\n') >~/.config/autostart/empathy.desktop
set -g status-keys vi
set -g status off
setw -g mode-keys vi
setw -g utf8 on
set -g prefix C-z
unbind C-b
bind C-z send-prefix
unbind 0; bind 0 select-window -t :9
objdump --section=.rodata --full-contents --start-address=0x3940 --stop-address="$((0x3940+0x2540))" NVIDIA-Linux-x86-256.29/kernel/nv-kernel.o | sed -nr 's/^ [0-9a-f]+ ([0-9a-f]{2})([0-9a-f]{2})0000.*/\2\1/p' | sort | uniq | grep -vx 0000
0040
0041
0042
0043
0044
0045
0046
0047