Skip to content

Instantly share code, notes, and snippets.


Adam Porter alphapapa

  • USA
View GitHub Profile
amzyang / createshortcut.js
Created Nov 29, 2011
create pentadactyl commandline options
View createshortcut.js
// createshortcut.js -- ++pentadactyl
// @Author: eric.zou (
// @License: GPL (see
// @Created: Tue 29 Nov 2011 01:24:05 PM CST
// @Last Change: Tue 29 Nov 2011 02:23:36 PM CST
// @Revision: 41
// @Description:
// @Usage:
// @TODO:
# Brad's el-ghetto do-our-storage-stacks-lie?-script
sub usage {
die <<'END';
Usage: -s <server[:port]> verify <file> -s <server[:port]> create <file> <size_in_MB> -l [port]
x4lldux / x4-smarter-beginning-of-line.el
Created May 25, 2013
Smarter beginning of the line
View x4-smarter-beginning-of-line.el
;; Smart beginning of the line
(defun x4-smarter-beginning-of-line ()
"Move point to beginning-of-line or first non-whitespace character or first non-whitespace after a comment sign."
(interactive "^")
(let (
(oldpos (point))
(indentpos (progn
chrp / fanny.rb
Created Aug 12, 2013
Auto adjust fan speed of graphics card with ATI catalyst driver on Ubuntu.
View fanny.rb
#!/usr/bin/env ruby
# encoding: utf-8
# first part, get temperature
temp_str = `aticonfig --adapter=0 --od-gettemperature`
temp = temp_str.scan(/Sensor 0: Temperature - (\d+\.\d+) C/)[0][0].to_i
# determine fan speed
thresholds = [ 40, 60, 70, 80, 85 ]
speeds = [ 10, 25, 30, 35, 50 ]
chaitanyagupta /
Last active Nov 27, 2022
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.

sprig / org-no-helm.el
Last active Mar 21, 2016
Advice for org-set-tags to disable helm completion
View org-no-helm.el
(defun kk/run-with-no-helm (orig-func &rest args)
"Run a function without helm completion."
(if (boundp 'helm-mode)
(let ((orig-helm-mode helm-mode))
(helm-mode 0)
(apply orig-func args)
(helm-mode (if orig-helm-mode 1 0))))
alphapapa / python-mode-outline-mode.el
Last active May 28, 2022
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)
dannguyen /
Last active Oct 23, 2022
Use wget to snapshot a page and its necessary visual dependencies

Use wget to mirror a single page and its visible dependencies (images, styles)

Money graphic via State of Florida CFO Vendor Payment Search

Graphic via State of Florida CFO Vendor Payment Search (

This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.

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'))