This file contains hidden or 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
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python | |
import urllib,json | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument( 'subreddit', nargs=1,help="Subreddit to browse, f.e. programming") | |
args= parser.parse_args() | |
subreddit = args.subreddit[0] | |
a = urllib.urlopen('http://www.reddit.com/r/'+str(subreddit)+'/.json') | |
try: |
This file contains hidden or 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
function $(s){ | |
z="getElement";n="Name"; | |
a={"#" : z+"ById", | |
"." : z+"sByClass"+n, | |
}[s[0]]; | |
a=typeof a==="undefined"?[z+"sByTag"+n,0]:[a,1]; | |
return document[a[0]](s.slice(a[1])); | |
} | |
function $$(s){return S="slice",d=document,t=s[0],g="getElement",n="Name",t=="#"?d[g+"ById"](s[S](1)):t=="."?d[g+"sByClass"+n](s[S](1)):d[g+"sByTag"+n](s)} |
This file contains hidden or 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-gnus-summary-view-html-alternative () | |
"Display the HTML part of the current multipart/alternative MIME message | |
in current default browser." | |
(interactive) | |
(save-current-buffer | |
(gnus-summary-show-article) | |
(set-buffer gnus-article-buffer) | |
(let ((file (make-temp-file "html-message-" nil ".html")) | |
(handle (nth 3 (assq 1 gnus-article-mime-handle-alist)))) | |
(mm-save-part-to-file handle file) |
This file contains hidden or 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
(evil-define-operator evil-capitalise (beg end type) | |
"Convert text to lower case." | |
(if (eq type 'block) | |
(evil-apply-on-block #'evil-capitalise beg end nil) | |
(capitalize-region beg end))) | |
(define-key evil-normal-state-map "gc" 'evil-capitalise) |
This file contains hidden or 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
(setq mu4e-bookmarks | |
'( ("flag:unread AND NOT flag:trashed AND date:today..now AND maildir:/INBOX" "Today's inbox" ?i) | |
("date:today..now AND NOT maildir:/INBOX.Sent" "Today's messages" ?t) | |
("date:30d..now AND maildir:/INBOX.Sent" "Sent last 30 days" ?s) | |
("date:7d..now" "Last 7 days" ?w) | |
("mime:image/*" "Messages with images" ?p) | |
("size:1M..500M" "Big messages" ?b)) | |
) | |
(add-to-list 'mu4e-header-info-custom |
This file contains hidden or 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
csvfix find -e 'Videos' -f 4 ~/Downloads/instapaper-export.csv | csvfix edit -e "s/[ ,.|:'\?]/_/g" -f 2 | csvfix order -f 2,1,3,4 | csvfix printf -fmt "wget --directory-prefix='./%s/' -T 60 -q -p -k %s" > x;cat x;chmod +x x;./x;rm ./x |
This file contains hidden or 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
---- | |
-- A tab chooser for Safari written with AppleScript (yikes) and HammerSpoon | |
---- | |
---- | |
-- Known issues: | |
-- If a tab has double quotes, unsure about what will happen, the tab | |
-- list creation is brittle. Single quote is fixed though |
This file contains hidden or 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
from __future__ import print_function | |
import ast | |
""" | |
Save the following in test.py, then execute fun_with_ast.py. | |
You can paste the output in a Scala interpreter | |
class something(object): | |
def __init__(self, value1, value2): |
This file contains hidden or 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
_fzf_complete_git() { | |
ARGS="$@" | |
local branches | |
branches=$(git branch -vv --all | sed "s/remotes\/origin\///g" | sed "s/\*/ /g") | |
if [[ $ARGS == 'git co'* ]]; then | |
_fzf_complete "--reverse --multi" "$@" < <( | |
echo $branches | |
) | |
else | |
eval "zle ${fzf_default_completion:-expand-or-complete}" |
OlderNewer