Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# encoding: utf-8
# to read the notifications from your local machine use something like this:
# ssh user@host.tld ": > ~/.weechat/onotify.log ; tail -f -q -s 2 ~/.weechat/onotify.log" | while read message; do notify-send "Weechat" "${message}"; done
import os.path
import weechat
SCRIPT_NAME = 'onotify'
SCRIPT_AUTHOR = 'Ole Bergmann <ole@ole.im>'
@Paaskehare
Paaskehare / .bashrc
Created October 26, 2012 08:41
Snippet to unify coloring of filetypes by their extension in bash
# Text files
LS_TEXT_FILES=(229 txt js py rb c cpp sh conf cfg pl log xml html php cer cfm csr css htm jsp)
# Archive files
LS_ARCH_FILES=(161 zip 7z Z rar tar.gz tar tar.xz tar.bz2 bz2 gz tbz2 tgz)
LS_FILE_EXTS=(LS_TEXT_FILES LS_ARCH_FILES)
LS_COLORS=""
for e in ${LS_FILE_EXTS[*]}; do
eval c=(\${$e[*]})
@Paaskehare
Paaskehare / das_download.py
Created October 24, 2012 22:17
Script for downloading all screencasts on Destroy All Software
#!/usr/bin/env python
# encoding: utf-8
import cookielib
import urllib
import urllib2
import re
@Paaskehare
Paaskehare / urlify.py
Created October 23, 2012 01:26
Python URLify snippet, will convert a sentence to a clean url-friendly slug, converted from javascript in django admin to slugify an URL
#!/usr/bin/env python
# encoding: utf-8
import re
LATIN_MAP = {
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
@Paaskehare
Paaskehare / gmail_unread.py
Created July 30, 2012 21:09
Python3 Script for counting unread emails from gmail, useful for conky
#!/usr/bin/env python
# encoding: utf-8
from urllib.request import FancyURLopener
username = 'username'
password = 'superlongandhardpassword'
url = 'https://%s:%s@mail.google.com/mail/feed/atom' % (username, password)
@Paaskehare
Paaskehare / url_title.py
Created November 11, 2011 07:44
Print titles for URLs, only in the active buffer
# encoding: utf-8
#
# Copyright (c) 2009 by ole <ole@ole.im>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#