Skip to content

Instantly share code, notes, and snippets.

View stilldavid's full-sized avatar
💽
minidisc'in

David Stillman stilldavid

💽
minidisc'in
View GitHub Profile
@stilldavid
stilldavid / HttpProxy.go
Created December 19, 2022 19:43 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
_ _
__ _| |_ __ _ __ _ (_)___
/ _` | __/ _` |/ _` | | / __|
| (_| | || (_| | (_| |_ | \__ \
\__, |\__\__,_|\__, (_)/ |___/
|___/ |___/ |__/
js?id=UA-38312895-1:80 Processing commands (0)
js?id=UA-38312895-1:80 Processing commands (1)
@stilldavid
stilldavid / oct-27-class.md
Last active November 15, 2017 14:45
Class notes from the October 28th Arduino class

Arduino Class 10/28

Thanks for attending the Arduino class!

You might be wondering what the little circuit board your child brought home is and what it's good for. The board is called an Arduino and it's a programmable microcontroller, which is just a fancy way of saying it's a little computer.

During class we all programmed them together to take a reading from a light sensor and activate a servo motor if a threshold was reached. In practice, this made for a super simple motion detector to make a head turn or a pumpkin move if it 'sensed' a shadow. The code is written in an Arduino variant of C++ that we uploaded using the Arduino IDE. The entirety of it is as follows:

#include <Servo.h>
@stilldavid
stilldavid / gist:1602315
Created January 12, 2012 18:46
Free Day Winners

1442 United States
108 Canada
41 United Kingdom
34 Spain
29 Netherlands
25 Sweden
25 Germany
20 Turkey
18 France
17 Italy

@stilldavid
stilldavid / freeday.ino
Created January 12, 2012 17:08
Free Day Geiger Counter
#include <Ethernet.h>
#include <SFEbarGraph.h>
#include <SPI.h>
// Default 'ino MAC address
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 2 };
int up = 8;
int down = 7;
// GPS
bool feedgps() {
gps_serial.println("$PUBX,00*33"); //Poll GPS
while (gps_serial.available()) {
if (gps.encode(gps_serial.read()))
return true;
}
return false;
}
{"type":"flight","name":"KI6YMZ-3","start":1318982400,"end":1318982400,"launch":{"time":1319036400,"timezone":"UTC-6"},"metadata":{"location":"Deer Trail, CO","project":"KI6YMZ-3"},"payloads":{"KI6YMZ":{"radio":{"frequency":"434.650","mode":"USB"},"telemetry":{"modulation":"rtty","shift":"425","encoding":"ascii-8","baud":"50","parity":"none","stop":"1"},"sentence":{"protocol":"UKHAS","checksum":"crc16-ccitt","payload":"KI6YMZ","fields":[{"name":"count","sensor":"base.ascii_int"},{"name":"time","sensor":"stdtelem.time"},{"name":"latitude","sensor":"stdtelem.coordinate","format":"dd.dddd"},{"name":"longitude","sensor":"stdtelem.coordinate","format":"dd.dddd"},{"name":"altitude","sensor":"base.ascii_int"},{"name":"speed_kph","sensor":"base.ascii_int"},{"name":"course","sensor":"base.ascii_int"},{"name":"temperature","sensor":"base.ascii_float"}]}}}}
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 20, 239 };
byte server[] = { 10, 10, 10, 2 }; // Google
Client client(server, 8001);
void setup()
Benchmarking 84.194.241.161 (be patient).....done
Server Software:
Server Hostname: 84.194.241.161
Server Port: 8080
Document Path: /
Document Length: 269 bytes
$$KI6YMZ,128,2574900,4006514,-10521007,159260,17,25528,2056*0055
$$KI6YMZ,129,2580600,4006514,-10521008,159260,4,25528,2056*006D
$$KI6YMZ,130,2582300,4006514,-10521007,159260,6,25528,2062*0068
$$KI6YMZ,131,2584000,4006514,-10521007,159260,16,25528,2062*005D
$$KI6YMZ,132,2585700,4006512,-10521006,159260,15,25528,2056*005B
$$KI6YMZ,133,2591400,4006511,-10521005,159260,3,25528,2056*006B
$$KI6YMZ,134,2593100,4006510,-10521006,159260,4,25528,2056*006E
$$KI6YMZ,135,2594800,4006510,-10521006,159260,16,25528,2056*0052
$$KI6YMZ,136,3000500,4006512,-10521006,159260,14,25528,2056*0055
$$KI6YMZ,137,3002200,4006513,-10521007,159260,15,25528,2056*0050