Skip to content

Instantly share code, notes, and snippets.

View haruo31's full-sized avatar

Haruo Kinoshita haruo31

View GitHub Profile
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@kraftb
kraftb / I2C_Adapter.ino
Created May 19, 2015 15:31
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
@philchristensen
philchristensen / django.cgi.py
Last active March 13, 2022 00:53
A very slow way to serve Django when all you have is CGI
#!/usr/bin/env python
# encoding: utf-8
"""
django.cgi
A simple cgi script which uses the django WSGI to serve requests.
Code copy/pasted from PEP-0333 and then tweaked to serve django.
http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_adisk._tcp</type>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=Time Capsule,adVF=0x82</txt-record>
</service>
<service>