Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am philhudson on github.
  • I am dije (https://keybase.io/dije) on keybase.
  • I have a public key whose fingerprint is 5D85 6F7D 2095 A1D7 4847 30E2 1A36 6FB6 4E48 2F85

To claim this, I am signing this object:

@PhilHudson
PhilHudson / clean-up-org-mobile-cruft.el
Last active August 29, 2015 14:02
Excise spurious Org agenda buffers leaked by org-mobile
(eval-when-compile
(require 'syntactic-sugar) ; for `then'
(require 'anaphora)) ; for `awhen'
(require 'org-mobile)
(defun ph/clean-up-org-mobile-cruft ()
"Excise spurious Org agenda buffers leaked by org-mobile."
(awhen (get-buffer "*SUMO*")
(then
@PhilHudson
PhilHudson / setup_timekpr
Created December 10, 2013 11:19
Install and configure timekpr on debian-derived GNU/Linux
#!/usr/bin/env bash
# USE AT OWN RISK. Read, understand and adapt.
# Part of my suite of new host configuration scripts
# $1: operating system, either 'linux', 'darwin', *bsd or 'cygwin'
if [ $# != 1 ]; then
echo "Usage: $0 os" 1>&2
exit 1
@PhilHudson
PhilHudson / Info.plist.patch
Created May 24, 2013 18:11
Shell script for pulling the latest Conkeror from git and building it.
--- Contents/Info.plist 2012-02-17 06:47:35.000000000 +0000
+++ foo/Info.plist 2012-02-15 14:02:14.000000000 +0000
@@ -2,6 +2,32 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleSignature</key>
+ <string>CNKR</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.mozdev.conkeror</string>
@PhilHudson
PhilHudson / gist:5188974
Created March 18, 2013 17:19
Files: ~/.screenrc ~/bin/short_day_name ~/bin/hr ~/bin/min ~/bin/sec ~/bin/copy-screen-copybuffer ~/bin/darwin/pbcopy
### .screenrc -*- mode: sh;-*-
# ==============================================================================
# Time-stamp: "2013-03-17 11:28:57 phil"
# ==============================================================================
defutf8 on
# Kill screen's startup message:
startup_message off
@PhilHudson
PhilHudson / gist:4054641
Created November 11, 2012 11:34
Workaround for identica-mode memory leak
(defun ph/kill-bogus-http-buffers ()
"Kill bogus http buffers created by `identica-mode' wtf."
(interactive)
(ignore-errors
(kill-buffers-matching
"^.\\*http 127\\.0\\.0\\.1:3128\\*\\(<[[:digit:]]+>\\)?")))
(add-hook 'identica-mode-hook 'ph/turn-off-filladapt-mode)
@PhilHudson
PhilHudson / gist:4054639
Created November 11, 2012 11:33
Workaround for identica-mode memory leak
(defun ph/kill-bogus-http-buffers ()
"Kill bogus http buffers created by `identica-mode' wtf."
(interactive)
(ignore-errors
(kill-buffers-matching
"^.\\*http 127\\.0\\.0\\.1:3128\\*\\(<[[:digit:]]+>\\)?"
)
)
)
@PhilHudson
PhilHudson / gist:3136942
Created July 18, 2012 15:30
rebuild_tags
#!/bin/sh
if [ "x${OSTYPE}x" = "xcygwinx" ]; then
ETAGS='etags -L'
ETAGS_INCLUDE_FILE_SWITCH='--etags-include'
elif [ "x${OSTYPE}x" = "xlinuxx" ]; then
ETAGS='etags -L'
ETAGS_INCLUDE_FILE_SWITCH='--etags-include'
else
ETAGS='etags'
ETAGS_INCLUDE_FILE_SWITCH='--include'
@PhilHudson
PhilHudson / gist:3136807
Created July 18, 2012 15:17
Auto-compile elisp
(defun ph/is-elisp-file (filename)
"Returns non-nil if FILENAME ends in either '.el' or '.el.gz'"
(string-match-p "\\.el\\(\\.gz\\)?\\'" filename)
)
(defun ph/autocompile-elisp ()
"Compiles and tags my custom elisp code files on save:
<`dot-emacs'>, and files under the <`ph/elisp-root'> directory.
References: `dot-emacs-file'"
@PhilHudson
PhilHudson / gist:1933912
Created February 28, 2012 17:44
C-style closing-paren indent for elisp
(defadvice lisp-indent-line (after my-trailing-parens-lisp-indentation)
"Make close parens on their own line indent like C"
(interactive)
(let (col-num)
(save-excursion
(beginning-of-line)
(when (looking-at "^\\s-*\)")
(search-forward "\)")
(backward-sexp)
(setf col-num (current-column))