Skip to content

Instantly share code, notes, and snippets.


Adam Porter alphapapa

  • USA
View GitHub Profile
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'))
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 ]
alphapapa / org-agenda-subtree-or-region.el
Last active Mar 21, 2016
Emacs: Display org-agenda for current subtree or region
View org-agenda-subtree-or-region.el
(defun org-agenda-subtree-or-region (prefix)
"Display an agenda view for the current subtree or region.
With prefix, display only TODO-keyword items."
(interactive "p")
(let (header)
(if (use-region-p)
(setq header "Region")
(put 'org-agenda-files 'org-restrict (list (buffer-file-name (current-buffer))))
(setq org-agenda-restrict (current-buffer))
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))))
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:
wzhd / .gitignore
Last active Dec 20, 2016 — forked from xiaoganghan/mynote.xml
Parsing Evernote export file (.enex) using Python
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 / better-org-return.el
Last active Apr 13, 2017
Better org-return
View better-org-return.el
(defun ap/org-return (&optional ignore)
"Add new list item, heading or table row with RET.
A double return on an empty element deletes it. Use a prefix arg
to get regular RET. "
;; See and
(interactive "P")
(if ignore
(cond ((eq 'link (car (org-element-context)))
alphapapa / org-avy-refile-as-child.el
Last active Apr 24, 2017
org-avy-refile-as-child: Refile Org heading as child of heading selected with Avy
View org-avy-refile-as-child.el
(defun ap/org-avy-refile-as-child ()
"Refile current heading as first child of heading selected with `avy.'"
;; Inspired by `org-teleport':
(let* ((org-reverse-note-order t)
(pos (save-excursion
(avy-with avy-goto-line (avy--generic-jump (rx bol "*") nil avy-style))
(filename (buffer-file-name (or (buffer-base-buffer (current-buffer))
View oref-start.el
;;; Neat convenience function for working with Elisp's EIEIO objects
(defmacro oref* (object &rest slots)
"Like `oref', but each slot in SLOTS is applied in sequence.
For example,
\(oref* obj :inner :property)
is equivalent to