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
# A class is a cookie cutter that can be used to stamp out instances | |
# This class models a farm (well one with animals on it, at least) | |
# This class inherits from "object" | |
class Farm(object): | |
def __init__(self, length, width, sheep, cattle, pigs, poultry): | |
self.length = length | |
self.width = width | |
self.sheep = sheep | |
self.cattle = cattle |
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
cd ~/programs | |
# not a repository | |
git status | |
# so init a repository | |
git init | |
# note the __pycache__ folder | |
# we don't want to version that |
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
### BASIC SETUP | |
# set pleasant tab stops | |
cat <<EOF >~/.nanorc | |
set tabsize 4 | |
set tabstospaces | |
EOF | |
# dir for all python command line programs | |
mkdir ~/programs |
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
-- lookup table mapping characters to bit representations | |
lookup = { | |
["A"] = 0x0e9c, | |
["B"] = 0x8ee0, | |
["C"] = 0x00cc, | |
["D"] = 0x8ce0, | |
["E"] = 0x00dc, | |
["F"] = 0x009c, | |
["G"] = 0x06cc, | |
["H"] = 0x0e1c, |
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
latch_pin = 2 | |
gpio.mode(latch_pin, gpio.OUTPUT) | |
gpio.write(latch_pin, gpio.LOW) | |
result = spi.setup(1, spi.MASTER, spi.CPOL_HIGH, spi.CPHA_LOW, spi.DATABITS_8, 0) | |
print(result) | |
while true do | |
for i=1,255,1 do | |
print(i) |
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
"http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" + escape(value + ", New South Wales", "url") | |
parseJson(value).results[0].geometry.location.lat | |
parseJson(value).results[0].geometry.location.lng |
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
{ | |
"type": "FeatureCollection", | |
"features": [ | |
{ | |
"type": "Feature", | |
"properties": { | |
"name": "UWS-Parramatta" | |
}, | |
"geometry": { | |
"type": "Polygon", |
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
# Measure current temp | |
/opt/vc/bin/vcgencmd measure_temp | |
# Read CPU scaling frequency | |
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
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
# sudo ifup wlan0 | |
# ifconfig wlan0 | |
wlan0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:ff | |
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 | |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
RX packets:16143 errors:0 dropped:0 overruns:0 frame:0 | |
TX packets:1982 errors:0 dropped:0 overruns:0 carrier:0 | |
collisions:0 txqueuelen:1000 | |
RX bytes:2970692 (2.8 MiB) TX bytes:121265 (118.4 KiB) |
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
# lsusb | grep Ralink | |
Bus 001 Device 007: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter | |
# lsmod | grep rt2 | |
rt2800usb 12069 0 | |
rt2800lib 47242 1 rt2800usb | |
rt2x00usb 11075 1 rt2800usb | |
rt2x00lib 41057 3 rt2x00usb,rt2800lib,rt2800usb | |
mac80211 236178 3 rt2x00lib,rt2x00usb,rt2800lib | |
cfg80211 171957 2 mac80211,rt2x00lib |
NewerOlder