Skip to content

Instantly share code, notes, and snippets.

@EnigmaCurry
EnigmaCurry / ip_checker.py
Created October 13, 2010 15:14
IP Address change notifier
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Ryan McGuire ([email protected])"
__date__ = "Wed Sep 1 22:05:31 2010"
#Check the current external IP address
#If it has changed, email me the new one (via cron)
#Update the dynamic DNS provider
@EnigmaCurry
EnigmaCurry / Calibre_remove_empty_books.sh
Created December 5, 2010 00:55
Remove empty books from calibre (books that have no formats available)
calibredb list -f title,author_sort,formats | grep ".*\[\]\W*$" | cut -d " " -f 1 | xargs -iXX calibredb remove XX
@EnigmaCurry
EnigmaCurry / ipython_virtualenv.py
Created February 9, 2011 01:52
Setup ipython to work in a virtualenv
#Call this inside ~/.ipython/ipy_user_conf.py main()
import sys
import subprocess
from os import environ
if 'VIRTUAL_ENV' in environ:
#This is kludgy but it works; grab the right sys.path from the virtualenv python install:
path = subprocess.Popen(['python', '-c','import sys;print(repr(sys.path))'],
stdout=subprocess.PIPE).communicate()[0]
@EnigmaCurry
EnigmaCurry / notify.py
Created February 17, 2011 03:06
Ubuntu Message Notifications
We couldn’t find that file to show.
@EnigmaCurry
EnigmaCurry / _0.README.markdown
Created March 2, 2011 00:21
A hack to get Blogofile 0.7.1 based blogs building on 0.7.2 or above

Blogofile 1.0-DEV (soon to be 0.7.2) changed the blog controller so that all of the configuration is done in the controller itself. Users upgrading to 0.7.2 will have a choice to make: upgrade their _controllers directory to use the new controller, or install this hack to get all the defaults back that got lost in translation.

from threading import Timer
class SuicidalKey(object):
"""
>>> k = SuicidalKey("asdf",30)
>>> k.key
'asdf'
>>> # Before 30 seconds are up
>>> k.reset_expiration(30)
>>> # Wait 30 seconds
@EnigmaCurry
EnigmaCurry / easy_install_2to3.py
Created March 25, 2011 02:31
An easy_install that forces packages to undergo 2to3 before installing.
import os
import os.path
import urllib
import tarfile
import tempfile
import shlex
def easy_install_2to3(package_name):
"""A lot of packages work just fine in py3k if you run them
through 2to3, but for whatever reason the authors have been too
---
categories: Test
date: 2011/04/04 15:25:00
title: Markdown lists
---
These are some lists in Markdown:
* list item 1
* list item 2
@EnigmaCurry
EnigmaCurry / 001 - test post
Created April 6, 2011 15:16
A blogofile template to include Post title and meta keywords
---
categories: General Stuff
date: 201/04/06 15:25:00
title: Just a test
keywords: test, another test, more "tests"
---
@EnigmaCurry
EnigmaCurry / latex.py
Created April 17, 2011 15:23
A LaTeX filter for blogofile
"""
Render TeX blocks to png
This is a Blogofile filter. Place it in your _filters directory.
"""
import tempfile
import subprocess
import shutil
import shlex
import os