Skip to content

Instantly share code, notes, and snippets.

@lucsmall
lucsmall / instructiosn
Created July 22, 2014 02:12
Refine Recipe
"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
@lucsmall
lucsmall / init.lua
Created September 28, 2015 07:02
Using Nodemcu to drive a 74HC595 shift register
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)
@lucsmall
lucsmall / init.lua
Created October 23, 2015 01:57
Using Nodemcu to drive B7971 nixie tubes via 74HC595 shift registers
-- lookup table mapping characters to bit representations
lookup = {
["A"] = 0x0e9c,
["B"] = 0x8ee0,
["C"] = 0x00cc,
["D"] = 0x8ce0,
["E"] = 0x00dc,
["F"] = 0x009c,
["G"] = 0x06cc,
["H"] = 0x0e1c,
@lucsmall
lucsmall / modules_and_packages.py
Created February 7, 2017 03:19
An example of using modules and packages in python
### BASIC SETUP
# set pleasant tab stops
cat <<EOF >~/.nanorc
set tabsize 4
set tabstospaces
EOF
# dir for all python command line programs
mkdir ~/programs
cd ~/programs
# not a repository
git status
# so init a repository
git init
# note the __pycache__ folder
# we don't want to version that
# 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