Skip to content

Instantly share code, notes, and snippets.

alphapapa / w
Created Nov 7, 2014
w: Print summary of Wikipedia article to STDOUT
View w
#!/usr/bin/env python
# Requires wikipedia module. '$ pip install wikipedia' Put it in your
# path and 'chmod +x'. Then just 'w whatever' and find out what
# something is! :D
# I couldn't find a good command-line utiity to do this.
# wikipedia2text is okay but it does the whole page, which isn't
# always what I want. The old command 'dig +short txt "$"'
# doesn't work anymore. But this works well.
alphapapa / python-mode-outline-mode.el
Last active Sep 15, 2020
Emacs: Python: outline-minor-mode headings for both Python keywords and standard commented-starred headings
View python-mode-outline-mode.el
(defun python-mode-outline-hook ()
(setq outline-level 'python-outline-level)
(setq outline-regexp
(rx (or
;; Commented outline heading
(* space) ; 0 or more spaces
(one-or-more (syntax comment-start))
(one-or-more space)
alphapapa / outline-mode-folding-python-elisp-shell.el
Created Mar 22, 2015
Emacs: outline-mode folding for Python, elisp, and shell
View outline-mode-folding-python-elisp-shell.el
(defun my/python-mode-outline-hook ()
(setq outline-level 'my/python-outline-level)
(setq outline-regexp
(rx (or
;; Commented outline heading
(* space) ; 0 or more spaces
(one-or-more (syntax comment-start))
(one-or-more space)
alphapapa /
Last active Sep 17, 2015
Pretty-print the last Firefox session's windows, tabs, and URLs. Useful for when Firefox fails to correctly reload a tab on start, and you have no idea what was loaded in that tab, but you know it was important.
#!/usr/bin/env python
import datetime, json, sys
def formatEntry(entry):
return "%s (%s) (%s)" % (entry['title'].encode('utf8')
if entry.has_key('title') else "<untitled>",
int(tab['lastAccessed']) / 1000).strftime('%Y-%m-%d %H:%M:%S'))
alphapapa /
Last active Sep 30, 2015
Fish functions and bindings for finding directories and files with Percol and locate
set -g percolOptions --prompt-bottom --result-bottom-up
# This is simply too slow right now, so using Bash instead
function onlyDirs
while read dir
test -d $dir
and echo $dir
# * pyt
# ** TODOS
# *** TODO Branch for downloading audio/video separately and playing with mplayer or something
# Both VLC and mplayer can play separate audio and video files
# together, but VLC doesn't have a command-line option for
alphapapa /
Created Oct 26, 2015 — forked from chaitanyagupta/
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. do their work at read-time.

View change-inner.el
(defun change-inner (prefix character)
"Kill region inside delimiters, using either beginning or
ending delimiter. With prefix arg, kill including delimiters."
(interactive "p\nc")
(let ((initial-point (point))
(move-point-by (if (> prefix 1) 0 1)))
View readingplan.txt
Read ESV in 90 sessions (Ultimate: Gosp+Ac, Rom-Rev)
[ ] October 31, 2015 Gen 1–9, Matt 1–2, Rom 1, Ps 1–3, Prov 1:1–7
[ ] November 01, 2015 Gen 10–19, Matt 3:1–5:12, Rom 2:1–3:8, Ps 4–6, Prov 1:8–19
[ ] November 02, 2015 Gen 20–26, Matt 5:13–6:15, Rom 3:9–4:12, Ps 7–8, Prov 1:20–33
[ ] November 03, 2015 Gen 27–32, Matt 6:16–7:29, Rom 4:13–5:21, Ps 9, Prov 2:1–10
[ ] November 04, 2015 Gen 33–41, Matt 8–9, Rom 6–7, Ps 10–12, Prov 2:11–22
[ ] November 05, 2015 Gen 42–50, Matt 10, Rom 8, Ps 13–16, Prov 3:1–12
[ ] November 06, 2015 Exod 1–8, Matt 11:1–12:21, Rom 9:1–29, Ps 17, Prov 3:13–18
[ ] November 07, 2015 Exod 9–16, Matt 12:22–13:30, Rom 9:30–10:21, Ps 18, Prov 3:19–26
alphapapa / mangle
Last active Jun 21, 2021
Mangle man pages to show just the parts you need (suitable for aliasing to "man")
View mangle
less_command='| less $less_no_init -aiF -Ps"Manual page\: $man_page (?ltline %lt?L/%L.:byte %bB?s/%s..? (END):?pB %pB\%..)"'
# Get section
if [[ $1 =~ [0-9]+ ]]