This file contains 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
""" | |
An experimental extension for an IPython magic command to show object graphs. | |
Strongly based on tkf's code for the extension itself | |
and mine for turning a Python namespace into a GraphViz DOT source: | |
- https://github.com/tkf/ipython-hierarchymagic | |
- http://pypi.python.org/pypi/pyrels/0.1.1 | |
Read respective copyrights there! |
This file contains 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
Verifying that +akaihola is my Bitcoin username. You can send me #bitcoin here: https://onename.io/akaihola |
This file contains 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
Copyright (c) 2013, Antti Kaihola | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, | |
are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright |
This file contains 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
#!/usr/bin/python3.3 | |
import os | |
NEWDIR = '/home/akaihol/Kuvat_' | |
OLDDIR = '/media/akaihol/tasku/Valokuvat' | |
def get_file_fingerprint(path): |
This file contains 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
import time | |
class InvalidOperation(Exception): | |
pass | |
class RepeatingCacheManager(object): | |
"""Recurring dynamic Celery task manager |
This file contains 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
#!/usr/bin/env python | |
"""Move listed files to a separate tree | |
Usage:: | |
cd /root/of/files | |
python mover.py <list-of-files.txt # only lists what will be moved | |
python mover.py -x <list-of-files.txt # actually moves the files |
This file contains 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
#!/bin/bash | |
# Salt minion bootstrap script for freshly installed Debian/Ubuntu | |
# virtual servers | |
# | |
# Let's assume you have a newly created Debian/Ubuntu VPS with no | |
# network interface running. To bootstrap Salt, copy this file into | |
# your home directory on the [SALT MASTER] and do the following on the | |
# VPS: | |
# |
This file contains 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
// Add this JS to the parent window, replacing the URL and width | |
// appropriately. | |
if (document.location.search == '?debug=1') { | |
document.write('<div id="autosizing-iframe-debug" style="position:absolute;width:233px;height:10em;overflow:scroll;margin-left:-233px;background:#cff;"></div>'); | |
}; | |
document.write('<iframe src="http://OTHERDOMAIN.COM/IFRAME/URL/" width="547px" height="10000px" frameborder="0" scrolling="no" id="autosizing-iframe" style="border: none;"></iframe>'); | |
(function() { | |
var debug = document.getElementById("autosizing-iframe-debug"), |
This file contains 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
"""Django Middleware for printing view's RSS usage after each request | |
Code for retrieving process memory information adapted from | |
http://code.activestate.com/recipes/286222-memory-usage/ | |
""" | |
import inspect | |
import os |
This file contains 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 django.core.cache.backends.base import BaseCache | |
from functools import wraps | |
import sys | |
class OldStyleClass: | |
pass | |
ClassType = type(OldStyleClass) | |