Skip to content

Instantly share code, notes, and snippets.

@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

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:

# -*- mode: snippet -*-
# name: add-to-list
# key: atl
# --
(add-to-list '${1:list} ${2:element}${3: ${4:&optional append-flag$$(yas-choose-value '("nil" "'append"))}${5: #'${6:compare-fn}}})$0
@PhilHudson
PhilHudson / shell_command_output.fail.js
Created April 9, 2015 11:52
Failing attempt to get shell command output in Conkeror
function shell_command_output (command) {
var error_text = "";
var output_text = "";
var exit_status = shell_command(
command,
$fds = [
{
output:
async_binary_string_writer("")
},
@PhilHudson
PhilHudson / shell-escaper.el
Created April 14, 2015 19:30
Shell-escape a string in Elisp
(defun ph/shell-escaper (matched-text)
"Return replacement text for MATCHED-TEXT when shell-escaping.
See `ph/shell-escape'."
(cond
;; Already escaped?
((string= matched-text "\\'")
"’")
;; Leading?
((string= matched-text "'")
(defun ph/yank-quote (&optional arg)
"Yank, passing optional prefix ARG to `yank', and quote."
(interactive "*P")
(yank arg)
(let
((end-marker (copy-marker (point-marker) t))
(start-marker (copy-marker (mark))))
(string-rectangle start-marker end-marker "> ")
(fill-region start-marker end-marker)))
// Time-stamp: "2015-05-03 14:02:16 phil"
// Section 7x is for Conkeror internal tweaks (?)
dumpln("72theme");
// Example: darken Astronomy Picture of the Day (APOD)
// register_user_stylesheet(
// make_css_data_uri(["body{background: black !important; color: grey !important;}",
// ":link, :link * {color: #4986dd !important;}",
// ":visited, :visited * {color: #d75047 !important;}"],
// $url_prefixes = "http://apod.nasa.gov/apod/"));
#!/usr/bin/env bash
# To be called by a GNU screen keybinding
screen_copybuffer_file="${HOME}/tmp/screen-copybuffer"
case "$OSTYPE" in
[Dd]arwin*)
pbcopy < "$screen_copybuffer_file"
#!/bin/tcsh -f
# For use by a terminal emulator as its startup script.
# Sets `DISPLAY' to `localhost:0.0' and launches/re-attaches `screen'.
echo ":0.0" > "$HOME/tmp/display"
switch ( "$OSTYPE" )
case "darwin":
set SCREEN='/opt/local/bin/screen'
breaksw
default:
set SCREEN='/usr/bin/screen'
#!/usr/bin/env bash
# Did caller pass in an epoch time to compare?
if [ $# = 1 ]; then
"${HOME}/bin/test-host-times-match" "$1" || echo 'WARNING: Time out of sync' 1>&2
fi
# Primes the (possibly new) screen session with a (possibly new) remote DISPLAY
echo "${DISPLAY:-:10.0}" > "${HOME}/tmp/display"