Skip to content

Instantly share code, notes, and snippets.

View dannystaple's full-sized avatar

Danny Staple dannystaple

View GitHub Profile
@dannystaple
dannystaple / hellobottle.py
Created October 28, 2011 16:34
Simple bottle example
from bottle import *
@route("/test")
def test():
return "<h1>Hello!</h1>"
run(host = "localhost", port=8100)
#include <Arduino.h>
class SR04 {
public:
int trigPin;
int echoPin;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
@dannystaple
dannystaple / bluetooth_remote.ino
Last active December 29, 2015 00:29
Code for Bluetooth Orion Explorer 1 Tutorial
#include "SoftwareSerial.h"
#include "TurtleMotors.h"
//Define the devices
Motor motor_left = {10, 8, 9};
Motor motor_right = {3, 4, 5};
TurtleMotors motors = {motor_left, motor_right, 255, 100};
SoftwareSerial mySerial(11, 12); // RX, TX
void setup() {
@dannystaple
dannystaple / TurtleMotors.h
Last active December 29, 2015 00:29
Turtle Motors for Explorer
#include <Arduino.h>
class Motor {
public:
int enable;
int in1;
int in2;
void setup() {
//Set all the pins as outputs
@dannystaple
dannystaple / serial_read_servo.ino
Created December 28, 2013 13:27
Testing/calibrating servo's with the Arduino - asks for a position and moves the servo there.
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(3);
Serial.begin(9600);
myservo.write(90);
}
red = string.char(255, 0, 0)
blue = string.char(0, 0, 255)
ws2812.writergb(1, red:rep(30)..blue:red(30))
@dannystaple
dannystaple / build.log
Created August 31, 2019 16:47
Jekyll Builder segfault
$ jekyll build
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-linux-musl]
/usr/gem/gems/ffi-1.11.1/lib/ffi/library.rb:112: [BUG] Illegal instruction at 0x00007f58683716e2
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-linux-musl]
-- Control frame information -----------------------------------------------
c:0026 p:---- s:0148 e:000147 CFUNC :open
c:0025 p:0022 s:0142 e:000141 BLOCK /usr/gem/gems/ffi-1.11.1/lib/ffi/library.rb:112 [FINISH]
c:0024 p:---- s:0133 e:000132 CFUNC :each
c:0023 p:0113 s:0129 e:000128 BLOCK /usr/gem/gems/ffi-1.11.1/lib/ffi/library.rb:109 [FINISH]
import vpython
import random
box_thickness = 0.2
box_size = 20
half_size = box_size / 2
vpython.box(length=box_thickness, width=box_size, height=box_size, opacity=0.2, pos=vpython.vector(half_size, 0, 0))
vpython.box(length=box_thickness, width=box_size, height=box_size, opacity=0.2, pos=vpython.vector(-half_size, 0, 0))
vpython.box(length=box_size, width=box_size, height=box_thickness, opacity=0.2, pos=vpython.vector(0, half_size, 0))
@dannystaple
dannystaple / pico_noise_button.py
Created January 25, 2021 21:17
Plug a piezo into pin 13, button into pin 14 (other side to 3v) and led into pin 15. Press the button for random noises.
import machine
import utime
import random
led_external = machine.Pin(15, machine.Pin.OUT)
buzzer = machine.Pin(13, machine.Pin.OUT)
button = machine.Pin(14, machine.Pin.IN, machine.Pin.PULL_DOWN)
pwm = machine.PWM(buzzer)
pwm.freq(3000)
$ (cd src/environments/prod; TF_LOG=trace terraform fmt -check -recursive)
2022-02-25T17:54:20.570Z [DEBUG] Adding temp file log sink: /var/folders/87/nv1zkt0s2nq86764_c0jf94h0000gn/T/terraform-log895494832
2022-02-25T17:54:20.570Z [INFO] Terraform version: 1.0.5
2022-02-25T17:54:20.570Z [INFO] Go runtime version: go1.16.4
2022-02-25T17:54:20.570Z [INFO] CLI args: []string{"/usr/local/bin/terraform", "fmt", "-check", "-recursive"}
2022-02-25T17:54:20.570Z [TRACE] Stdout is a terminal of width 172
2022-02-25T17:54:20.570Z [TRACE] Stderr is a terminal of width 172
2022-02-25T17:54:20.570Z [TRACE] Stdin is a terminal
2022-02-25T17:54:20.570Z [DEBUG] Attempting to open CLI config file: /Users/danielstaple/.terraformrc
2022-02-25T17:54:20.570Z [DEBUG] File doesn't exist, but doesn't need to. Ignoring.