Skip to content

Instantly share code, notes, and snippets.

View faried's full-sized avatar

Faried Nawaz faried

View GitHub Profile
diff --git a/r2/r2/templates/base.xml b/r2/r2/templates/base.xml
index 8422b2d..11766a4 100644
--- a/r2/r2/templates/base.xml
+++ b/r2/r2/templates/base.xml
@@ -25,11 +25,13 @@
%>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:media="http://search.yahoo.com/mrss">
+ xmlns:media="http://search.yahoo.com/mrss"
;; i don't know if anyone needs this, but i find this useful: a context menu for twittering-mode
;;
(setq twittering-mode-menu-map (make-sparse-keymap "Twittering Mode"))
(let ((map twittering-mode-menu-map))
(define-key map [ct] (cons "Copy tweet" 'twittering-push-tweet-onto-kill-ring))
(define-key map [cl] (cons "Copy link" 'twittering-push-uri-onto-kill-ring))
(define-key map [ll] (cons "Load link" 'twittering-click)))
(defalias 'twittering-mode-menu-map twittering-mode-menu-map)
(define-key twittering-mode-map [C-down-mouse-3] 'mouse-set-point)
(define-key twittering-mode-map [C-mouse-3] 'twittering-mode-menu-map)
diff --git a/twittering-mode.el b/twittering-mode.el
index 3a34794..143599c 100644
--- a/twittering-mode.el
+++ b/twittering-mode.el
@@ -428,6 +428,7 @@ StatusNet Service.")
(mentions . "statuses/mentions")
(public . "statuses/public_timeline")
(replies . "statuses/replies")
+ (favorites . "favorites")
(retweeted_by_me . "statuses/retweeted_by_me")
@faried
faried / booklist.py
Created December 11, 2010 19:22
read a list of isbn numbers from a google docs spreadsheet, update related title/author cells.
#!/usr/bin/env python
"""Get title/author for ISBNs in a Google Docs spreadsheet."""
from getpass import getpass
import os
import os.path
import sys
from gdata.spreadsheet import service, SpreadsheetsList
from gdata.books import service as bservice
@faried
faried / maildirtocouch.py
Created February 1, 2011 22:02
Store messages in a Maildir into a couchdb database.
#!/usr/bin/env python
"""Store messages in a Maildir into a couchdb database."""
import couchdb
from mailbox import Maildir
from optparse import OptionParser
import os
from pprint import pprint
import sys
from uuid import uuid4
@faried
faried / gist:813583
Created February 6, 2011 18:28
try harder to parse headers
def utf8decode(thing):
"""Try to convert from ASCII to UTF-8."""
try:
return thing.decode('utf-8')
except UnicodeDecodeError, _exc:
# many badly created messages will be like this
try:
return thing.decode('iso-8859-15')
except UnicodeDecodeError, exc:
;; example function to call
(defun underline-char (char-point)
(add-text-properties char-point (1+ char-point)
'(face underline)))
(defun do-high-ascii (fn)
(interactive "aFunction: ")
(save-excursion
(goto-char (point-min))
(while (< (point) (point-max))
@faried
faried / maildirtocouch.py
Created February 9, 2011 21:37
Parse out a few headers, store doc in db and then attach email attachments.
#!/usr/bin/env python
"""Store messages in a Maildir into a couchdb database."""
import couchdb
from email.header import decode_header
from email.utils import parseaddr, getaddresses
import logging
from mailbox import Maildir
from optparse import OptionParser
import os
@faried
faried / subredditauthors.py
Created June 24, 2011 07:37
Print out list of authors common in two subreddits.
#!/usr/bin/env python
"""Print out list of authors common in two subreddits."""
from json import loads
# from hashlib import sha1
import sys
from time import sleep
from urllib2 import urlopen
URLBASE = 'http://www.reddit.com/r/%s/.json'
@faried
faried / Makefile
Created September 1, 2011 23:09
makefile for inform6 project
CFLAGS= -I.
PROG= inform6
SRCS= arrays.c asm.c bpatch.c chars.c directs.c errors.c expressc.c expressp.c \
files.c inform.c lexer.c linker.c memory.c objects.c states.c symbols.c \
syntax.c tables.c text.c veneer.c verbs.c
OBJS= ${SRCS:.c=.o}
all: $(PROG)
clean: