Skip to content

Instantly share code, notes, and snippets.

View gammy's full-sized avatar

gammy gammy

  • Stockholm
View GitHub Profile
@gammy
gammy / avr_write.bash
Created December 20, 2011 14:00
avrdude wrapper scirpt
#!/bin/bash
hex=$1
config=/home/gammy/code/arduino_hacks/arduino-0021/hardware/tools/avrdude.conf
processor=atmega1280
programmer=usbtiny
iface=usb
trap boom ERR
@gammy
gammy / kb_chk_esc
Created January 6, 2012 16:02
16 bit 486 escape key detect
kb_chk_esc:
xor ax, ax
mov ah, 1 ; get keystroke status
int 0x16
jz kb_chk_end ; no key
mov ah, 0 ; get key
int 0x16
cmp al, 27 ; is it esc?
jne kb_chk_end ; nope
call exit ; yup
@gammy
gammy / import_seq.bash
Created January 15, 2012 22:17
# Import sequential filenames with bash, ls, wc, date and import.
#!/bin/bash
# Import sequential filenames.
dst="$HOME/Pictures/screenshots/"
if [ ! -d "$dst" ]; then
echo "\"$dst\" is not a directory."
exit 1
fi
@gammy
gammy / cpu_speed_list
Created January 21, 2012 22:27
Create array containing current CPU speed of each processor. Requires procfs.
speeds=($(grep MHz /proc/cpuinfo | cut -d ":" -f 2 | cut -d " " -f 2))
@gammy
gammy / gist:1659848
Created January 23, 2012 01:29
Fix missing attributes problem (Openshot 1.4 with Blender 2.61)
From http://www.reelpassion.com/process/CreateJournalEntryComment?moduleId=13871766&entryId=14366848&finalize=true:
Encountered this issue while attempting to use animated text effects in OpenShot 1.4:
AttributeError: 'RenderSettings' object has no attribute 'file_format'
Huh?...why is this attribute missing?
Because OpenShot is relying on the builtin blender api's, and expecting blender to match the scripts it uses to render animated effects. However, blender has moved faster than openshot and dropped a few attributes along the way. If you go to the blender page and follow the api changes to it's bpy module you see that the 'file_format' attribute along with 'color_mode' have magically disappeared.
So...insisting on keeping blender 2.61, I applied the following command(hack) to the source code of openshot to comment out these missing attributes - and thankfully the lens flare effect that I'm trying to use is finally working:
$ cd <..>openshot/blender/scripts
@gammy
gammy / waituntil.bash
Created February 9, 2012 01:15
Wait until bash script.
#!/bin/bash
while [ $(date +%R) != "$1" ]; do
sleep 1;
done
shift
$*
@gammy
gammy / gist:1804957
Created February 11, 2012 23:15
pekwm submenu with xrandr two-screen configuration options
Submenu = "Desktop" {
Entry = "Detect & enable screens" { Actions = "Exec xrandr --auto &" }
Entry = "HDMI left of laptop" { Actions = "Exec xrandr --auto --output HDMI1 --right-of LVDS1 --output LVDS1 &" }
Entry = "HDMI right of laptop" { Actions = "Exec xrandr --auto --output HDMI1 --left-of LVDS1 --output LVDS1 &" }
Entry = "HDMI above laptop" { Actions = "Exec xrandr --auto --output HDMI1 --above LVDS1 --output LVDS1 &" }
Entry = "HDMI below laptop" { Actions = "Exec xrandr --auto --output HDMI1 --below LVDS1 --output LVDS1 &" }
Entry = "Disable HDMI" { Actions = "Exec xrandr --output LVDS1 --output HDMI1 --off &" }
Entry = "Disable laptop" { Actions = "Exec xrandr --output HDMI --output LVDS1 --off &" }
}
@gammy
gammy / lwatch.bash
Created April 20, 2012 09:53
Poor man's watch
#!/bin/bash
# Poor man's "watch"
# Depends on bash, date, stty & head.
if [ ${#@} -lt 2 ]; then
echo "Usage: $(basename $0) <interval> <command>"
exit 1
fi
t=$1
@gammy
gammy / gist:2634113
Created May 8, 2012 10:30
udevadm attribute walk line
udevadm info --name=/dev/sda --attribute-walk
@gammy
gammy / gist:2652827
Created May 10, 2012 12:48
2012 Summer holiday planner
Summer 2012
(Man -> Kastrup -> Copenhagen -> Malmo -> Sthlm -> Yxta -> Sthlm -> Man)
Jun.....................................Jul..................
|Th Fr Sa Su|Mo Tu We Th Fr Sa Su|Mo Tu We Th Fr Sa Su|Mo Tu|
|21 22 23 24|25 26 27 28 29 30 1| 2 3 4 5 6 7 8| 9 10|
Event | DD DD DD| YY YY YY| | |
Shorthand | Dad | Yxtaholm| | |
Vacation days |XX XX |XX XX XX XX XX |XX XX XX XX XX |XX |