Skip to content

Instantly share code, notes, and snippets.

View mattkatz's full-sized avatar

Matt Katz mattkatz

View GitHub Profile
@mattkatz
mattkatz / export_opml.php
Created June 20, 2012 10:03
Exporting data from wordpress.
<?php
// Set the headers so the file downloads
header('Content-type: application/xml+opml');
header('Content-Disposition: attachment; filename="Wordprss-OPML-Export.xml"');
//oh PHP. Why you gotta be so difficult about escaping things?
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">";
?>
<opml version="1.0" >
<head>
@mattkatz
mattkatz / .htaccess
Created December 27, 2011 20:13
Slim not logging or routing
#RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
#RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php [QSA,L]
from pyechonest import config
from pyechonest import catalog
import uuid
import time
def print_timing(func):
def wrapper(*arg):
t1 = time.time()
res = func(*arg)
#top {
position:absolute;
right:50px;
top:5px;
}
#bottom {
position:absolute;
right:5px;
top:30px;
}
//merging http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html
//and http://vafer.org/blog/20071112204524
ftpClient = getConnectedFTPClient();
public class GalleryLister{
public FTPClient mFtp;
public ArrayList mAccumulator;
private String sep = "|";
private String prefix = "";
@mattkatz
mattkatz / Library_Droid.py
Created August 26, 2010 17:42
updated version of Library Droid
import android
droid = android.Android()
code = droid.scanBarcode()[1]
isbn = code['extras']['SCAN_RESULT']
url = "http://librarything.com/isbn/%s" % isbn
droid.startActivity('android.intent.action.VIEW', url)
@mattkatz
mattkatz / judge_droid.py
Created March 30, 2010 18:41
Judge Droid Lays Down the Law
"""
Lays down the law for your phone, telling it what to do and when
Inspired by docblades' silent_night.py
"""
import android, string, time, math, datetime
from datetime import time, datetime, timedelta
from time import sleep
from threading import Timer
droid = android.Android()
interval_secs = 480
@mattkatz
mattkatz / microbloggable.py
Created March 30, 2010 00:39
Microbloggable.py
# microbloggable.py
# breaks a story up into notices or tweets
# By Matt Katz: http://www.morelightmorelight.com
# this code is public domain but please
# say hi: http://identi.ca/mattkatz
# open a file
text_in = 'c:/last-beautiful.txt'
output = 'c:/twitterable.txt'
def process_story(file_in, file_out):
compaudit | xargs chmod g-w
mkdir ~/.ssh
touch ~/.ssh/known_hosts
echo "set completion-ignore-case On" > ~/.inputrc