View print-firefox-session.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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>", | |
entry['url'].encode('utf8'), | |
datetime.datetime.fromtimestamp( | |
int(tab['lastAccessed']) / 1000).strftime('%Y-%m-%d %H:%M:%S')) |
View fanny.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ] |
View org-agenda-subtree-or-region.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) | |
(progn | |
(setq header "Region") | |
(put 'org-agenda-files 'org-restrict (list (buffer-file-name (current-buffer)))) | |
(setq org-agenda-restrict (current-buffer)) |
View org-no-helm.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) | |
(unwind-protect | |
(progn | |
(helm-mode 0) | |
(apply orig-func args) | |
) | |
(helm-mode (if orig-helm-mode 1 0)))) |
View createshortcut.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// createshortcut.js -- ++pentadactyl | |
// @Author: eric.zou (frederick.zou@gmail.com) | |
// @License: GPL (see http://www.gnu.org/licenses/gpl.txt) | |
// @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: | |
// @CHANGES: |
View .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.enex |
View outline-mode-folding-python-elisp-shell.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my/python-mode-outline-hook () | |
(setq outline-level 'my/python-outline-level) | |
(setq outline-regexp | |
(rx (or | |
;; Commented outline heading | |
(group | |
(* space) ; 0 or more spaces | |
(one-or-more (syntax comment-start)) | |
(one-or-more space) |
View better-org-return.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 https://gist.github.com/alphapapa/61c1015f7d1f0d446bc7fd652b7ec4fe and | |
;; http://kitchingroup.cheme.cmu.edu/blog/2017/04/09/A-better-return-in-org-mode/ | |
(interactive "P") | |
(if ignore | |
(org-return) | |
(cond ((eq 'link (car (org-element-context))) |
View org-avy-refile-as-child.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ap/org-avy-refile-as-child () | |
"Refile current heading as first child of heading selected with `avy.'" | |
;; Inspired by `org-teleport': http://kitchingroup.cheme.cmu.edu/blog/2016/03/18/Org-teleport-headlines/ | |
(interactive) | |
(let* ((org-reverse-note-order t) | |
(pos (save-excursion | |
(avy-with avy-goto-line (avy--generic-jump (rx bol "*") nil avy-style)) | |
(point))) | |
(filename (buffer-file-name (or (buffer-base-buffer (current-buffer)) | |
(current-buffer)))) |
View oref-start.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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 |
OlderNewer