Skip to content

Instantly share code, notes, and snippets.

View hamsolodev's full-sized avatar

hamsolo.dev hamsolodev

View GitHub Profile
#!/bin/zsh -w
# This hook is run after this virtualenv is activated.
# If the virtualenv has a .project file in it then check to see the
# path contained within it exists, and if so collect etags for .py
# files in that path. Also includes etags generated for the
# virtualenv itself—if it finds them. Virtualenv tags are generated
# with the `venvtags` function defined in .zshrc: which should be run
# manually after, for example, installing new requirements. The
# resulting TAGS file is then hooked into the virtualenv by a

Puppet Camp Melbourne

  • check out Puppet Forge
  • upgrade to Puppet 3.0 ASAP
    • big performance and memory handling improvements over 2.7
    • Hiera used internally

Puppet for sysadmins

  • Puppet can write puppet
@hamsolodev
hamsolodev / err
Created February 10, 2013 02:25
FreeBSD 9.1 error installing avr-binutils port
===> Compressing manual pages for avr-binutils-2.20.1_1
===> Registering installation for avr-binutils-2.20.1_1
Installing avr-binutils-2.20.1_1...pkg: avr-binutils-2.20.1_1 conflicts with binutils-2.23.1 (installs files into the same place). Problematic file: /usr/local/share/locale/da/LC_MESSAGES/bfd.mo
*** [fake-pkg] Error code 70
Stop in /usr/ports/devel/avr-binutils.

Arch Linux install notes

Notes on installing Arch Linux from scratch, using LVM partitions.

There's no installer as such; instead, there's a series of tasks carried out on the commandline to partition the disk and bootstrap base packages &c.

Followed the Installation Guide, with forays into other wiki pages to gather configuration options as required.

Boot installation media

(defadvice deft-new-file (after deft-markdown-title
activate compile)
"After Deft creates a new file, make the supplied text a Markdown header"
(if (string-equal deft-text-mode "markdown-mode")
(progn
(goto-char (point-min))
(insert "# ")
(goto-char (point-max)))))
;; Toggle between split windows and a single window
(defun toggle-windows-split()
"Switch back and forth between one window and whatever split of
windows we might have in the frame. The idea is to maximize the
current buffer, while being able to go back to the previous split
of windows in the frame simply by calling this command again."
(interactive)
(if (not (window-minibuffer-p (selected-window)))
(progn
;; use OSX's Quick Look to browse file:/// URLs
(defun osx-qlook (url &optional some-stuff)
(message "Launching Quick Look preview...")
(start-process
"qlmanage"
(get-buffer-create "*qlmanage*")
"/usr/bin/qlmanage"
"-p"
;; strip “file://” from URL
@hamsolodev
hamsolodev / ds18b20.py
Created April 12, 2012 06:26
convert two bytes from DS18B20 temperature reading register into usable temperature
def ds18b20_convert(lsb, msb):
"""
Converts the 16-bit sign-extended two’s complement number, stored
in the DS18B20's temperature register, into a temperature.
"""
reading = lsb + (msb << 8)
inv = reading & 0x8000
if inv: # two's compliment
reading = (reading ^ 0xffff) + 1
val = reading / 16.0
@hamsolodev
hamsolodev / .zshrc
Created August 28, 2011 03:02
zsh function to control OSX Pomodoro app from shell
# use AppleScript to communicate with the Pomodoro application
function pom {
case $1 in
start)
# if it weren't for the use of arg ranges here then this function would work in straight sh
TASK=$*[2,-1]
DURATION=25
BREAK=5
osascript -e "tell app \"Pomodoro\" to start \"${TASK}\" duration ${DURATION} break ${BREAK}"
@hamsolodev
hamsolodev / .zshrc
Created August 27, 2011 08:08
stupidly simple starting & stopping of Pomodoro from commandline
# use AppleScript to communicate with the Pomodoro application on OSX
function pom {
case $1 in
start)
osascript -e "tell app \"Pomodoro\" to start \"${*}\" duration 25 break 5"
;;
stop)
osascript -e "tell app \"Pomodoro\" to reset"
;;
pause)