Skip to content

Instantly share code, notes, and snippets.


Matt H matthewhochler

View GitHub Profile
iiska /
Created Oct 22, 2009
Simple XML Schema validator in Python using lxml library
#! /usr/bin/python
# -*- coding: utf-8 -*-
# Simple XML validator done while learning the use of lxml library.
# -- Juhamatti Niemelä <iiska AT iki DOT fi>
import lxml
from lxml import etree
if __name__ == "__main__":
esperlu /
Created Apr 27, 2011
MySQL to Sqlite converter
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
aaugustin /
Last active Jan 22, 2021
Read-only ModelAdmin for Django
from django.contrib import admin
class ReadOnlyModelAdmin(admin.ModelAdmin):
ModelAdmin class that prevents modifications through the admin.
The changelist and the detail view work, but a 403 is returned
if one actually tries to edit an object.
saetia / gist:1623487
Last active Jan 12, 2022
Clean Install – OS X 10.11 El Capitan
View gist:1623487

OS X Preferences

most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
erikh /
Created Mar 31, 2012 — forked from DAddYE/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
g3d / gist:2709563
Last active Dec 30, 2021 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
jacob414 /
Created May 16, 2012 — forked from shazow/
Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git (for a Linode Stackscript)
# Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git
# From:
function usage() {
cat << EOF
-y No prompts, assume yes to all.
jboner / latency.txt
Last active Jan 27, 2022
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
statico / gist:3172711
Created Jul 24, 2012
How to use a PS3 controller on Mac OS X 10.7 (Lion)
View gist:3172711

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

dsummersl / makeFullScreen.applescript
Created Nov 30, 2012
Applescript script for toggling applications in and out of fullscreen mode.
View makeFullScreen.applescript
on run argv
Toggle an application from full screen to non full screen (or the reverse).
1: application name(ie, Chrome)
2: boolean (true/false).
When true ensure that the application is in full screen mode (if not, make it so)
When false ensure that the application is NOT in full screen mode (if not, make it so)
set theapp to item 1 of argv