This file contains hidden or 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
PS1="$ " | |
alias pserve="python -m SimpleHTTPServer" | |
# show git branch in prompt | |
export PS1="(\$(git branch 2>/dev/null | grep '^*' | colrm 1 2))\$ " | |
source /usr/local/etc/bash_completion.d/git-completion.bash | |
# http://unix.stackexchange.com/a/48113 |
This file contains hidden or 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
<?php | |
function add_cache($key, $value, $ttl) { | |
$dir = __DIR__.'/../cache/'; | |
// Remove slashes for security | |
$filename = $dir . str_replace('/', '', $key); | |
// Store expiry in first line | |
$lines = [(string)(time() + (int)$ttl), $value ]; | |
if (!file_exists($dir)) mkdir($dir, 0755, true); | |
file_put_contents($filename, implode("\n", $lines)); |
This file contains hidden or 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 | |
""" | |
The idea is to take stdin, and write it to a new unique log file | |
php myscript.php | newlog filename | |
""" | |
import os | |
import sys |
This file contains hidden or 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/sh | |
# read from stdin, write to a temp file, open the temp file in a browser, then delete it | |
tmpfile=$(mktemp).html; cat > $tmpfile; open $tmpfile; #rm $tmpfile |
This file contains hidden or 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.db import models | |
from with_distance_manager import WithDistanceManager | |
class Foo(models.Model): | |
longitude = models.DecimalField(max_digits=19, decimal_places=10, null=True) | |
latitude = models.DecimalField(max_digits=19, decimal_places=10, null=True) | |
objects = WithDistanceManager() |
This file contains hidden or 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
error_log /dev/stderr; | |
events {} | |
http { | |
#access_log /dev/stdout; | |
access_log /dev/null; | |
server { | |
listen 8066; | |
server_name _; | |
location / { | |
proxy_pass http://rchrd.net; |
This file contains hidden or 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
# Jeff McCune <[email protected]> | |
# 2010-07-30 | |
# GNU Screen configuration file | |
defutf8 on | |
defflow off | |
vbell off | |
autodetach on | |
startup_message off | |
defscrollback 10000 |
This file contains hidden or 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
<?php | |
function require_auth() { | |
$AUTH_USER = 'admin'; | |
$AUTH_PASS = 'admin'; | |
header('Cache-Control: no-cache, must-revalidate, max-age=0'); | |
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])); | |
$is_not_authenticated = ( | |
!$has_supplied_credentials || | |
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER || | |
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS |
This file contains hidden or 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/local/bin/python | |
print """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam volutpat velit lorem, a aliquet mi egestas sit amet. Aliquam vitae mauris sit amet enim pellentesque consequat. Maecenas et nisi massa. Donec mi justo, mattis et tellus nec, elementum porttitor libero. Ut a lacus vitae orci mollis suscipit. Maecenas ullamcorper ligula in eros facilisis, et hendrerit neque sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec et quam quis metus ullamcorper dignissim. Nullam faucibus at nulla vel imperdiet. Ut nec pharetra eros. Aliquam erat volutpat. Curabitur sem diam, cursus ultricies velit non, placerat consequat velit. | |
Integer ut arcu id felis consectetur ultrices. Fusce ac augue ligula. Integer tempor lobortis posuere. Nam magna quam, efficitur varius blandit vitae, vulputate a diam. Suspendisse eu turpis aliquet ligula molestie commodo id consectetur lorem. Curabitur ornare, turpis vitae commodo hendrerit, sapien just |
This file contains hidden or 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
Here are the exact parts I used: | |
USB HOST - This has all the software pre-installed. Just need to wire it up. | |
1x $16.76 http://www.hobbytronics.co.uk/usb-host-midi | |
MIDI Breakout board - This handles the extra components needed to wire up midi | |
1x $11.95 http://www.amazon.com/ubld-it-MIDI-Breakout-Board/dp/B00YDLVLVO/ref=sr_1_1?ie=UTF8&qid=1464058935&sr=8-1&keywords=midi+breakout | |
Power - Needed a usb-power breakout board and a power supply | |
1x $1.50 https://www.adafruit.com/products/1764 |