Skip to content

Instantly share code, notes, and snippets.

;; An Org-mode capture template for scheduling a phone call to a BBDB contact.
;; Shortcut key: c
;; Target location: Under headline "Incoming" in file "~/org/ToDo.org".
;; Default tags: @phone
;; The function `ph/capture-bbdb' (see below) handles BBDB contacts with either a name or only an organization.
;;
;; To use this capture template, first mark the whole of the specific phone number you
;; want within the contact record in the *BBDB* buffer, then hit C-c t c.
;;
;; Prompts for:
#!/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"
#!/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
# To be called by a GNU screen keybinding
screen_copybuffer_file="${HOME}/tmp/screen-copybuffer"
case "$OSTYPE" in
[Dd]arwin*)
pbcopy < "$screen_copybuffer_file"
// 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/"));
(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)))
@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 "'")
@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("")
},
# -*- 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
clear Mod1
clear Mod2
clear Mod3
clear Lock
!clear Mod4
keycode 63 = Mode_switch
keycode 71 = Mode_switch
keycode 66 = Meta_L
keycode 69 = Meta_R
keycode 65 = Super_L