Skip to content

Instantly share code, notes, and snippets.

View fmoralesc's full-sized avatar

Felipe Morales fmoralesc

  • Leuven, Belgium
View GitHub Profile
@fmoralesc
fmoralesc / gist:3268765
Created August 6, 2012 01:06
cleaning up pacmatic output
From 5fa8c1c3e8bfa0ae7cf928e56df2bd408ce14e89 Mon Sep 17 00:00:00 2001
From: Felipe Morales <hel.sheep@gmail.com>
Date: Sat, 4 Aug 2012 19:27:06 -0300
Subject: [PATCH] Further cleanup of rss feeds
If available, pass the feed data through pandoc or html2text before displaying.
---
pacmatic | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
@fmoralesc
fmoralesc / nv2pad.py
Created January 16, 2012 13:39
import nv notes to vim-pad
#/usr/bin/env python2
from sys import argv
from os import listdir
from os.path import getmtime
from shutil import copy, move
def import_nv(rename=False):
op = move if rename else copy
files_to_import = filter(lambda i: not i.isdigit(), listdir("."))
@fmoralesc
fmoralesc / PKGBUILD.sh
Created November 9, 2011 22:26
firefox-aurora PKGBUILD
# Maintainer: Dan Serban
# Contributors: L42y, aeosynth, fmoralesc
pkgname=firefox-aurora
pkgver=latest
pkgrel=1
pkgdesc="Aurora channel"
url=http://www.mozilla.org/projects/firefox/
arch=(i686 x86_64)
license=(MPL GPL LGPL)
@fmoralesc
fmoralesc / pipelines.py
Created October 20, 2011 03:23
Shell Pipelines for Python
from subprocess import Popen, PIPE
import re
import glob
import shlex
class Pipeline(object):
def __init__(self, descriptor=None):
self.steps = []
if descriptor:
for step in descriptor.split("|"):
@fmoralesc
fmoralesc / gist:1204775
Created September 8, 2011 21:22
bibtool + regex parser
#!/usr/bin/env python2
# usage: script.py QUERY BIBFILE
import sys
import os
import re
from subprocess import Popen, PIPE
title_search = re.compile("\s*[Tt]itle\s*=\s*{(?P<title>\S.*)},\n")
@fmoralesc
fmoralesc / gist:1203698
Created September 8, 2011 15:36
minimal regex based bibtex parser
#!/usr/bin/env python2
# usage: script.py QUERY BIBFILE
import sys
import re
title_search = re.compile("\s*[Tt]itle\s*=\s*{(?P<title>\S.*)},\n")
booktitle_search = re.compile("\s*[Bb]ooktitle\s*=\s*{(?P<title>\S.*)},\n")
author_search = re.compile("\s*[Aa]uthor\s*=\s*{(?P<author>\S.*)},\n")
@fmoralesc
fmoralesc / detect_lang.vim
Created October 15, 2010 20:52
a vim script for detecting the language of a text file and setting the spelling language automatically.
if (exists("g:loaded_detect_lang") && g:detect_lang) || &cp
finish
endif
let g:detect_lang = 1
command! DetectLanguage exec('py detect_language()')
command! SetSpellLang exec('py detect_and_set_spelllang()')
python <<EOF
@fmoralesc
fmoralesc / sendmail.vim
Created April 22, 2010 19:49
a vim script for sending emails
if (exists("g:loaded_sendmail") && g:loaded_sendmail) || &cp
finish
endif
let g:loaded_sendmail = 1
command! -complete=custom,ListAddresses -nargs=1 Email exec('py sendmail_email("<args>")')
fun ListAddresses(A,L,P)
return system("(grep -o '84=[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' ~/.thunderbird/*.default/abook.mab && cat /home/felipe/.vim/plugin/sendmail.addresslist) | sed -s 's/84=//' | sort | uniq -u")