Skip to content

Instantly share code, notes, and snippets.

@halfd
halfd / boxcollision.pde
Created October 3, 2018 12:32
Simple Box Collision
Box box1;
Box box2;
void setup()
{
rectMode( CENTER );
noStroke();
size(600, 600);
box1 = new Box();
@halfd
halfd / Cards.pde
Created October 3, 2018 09:21
Simple Card Management in Processing
Deck myDeck;
void setup() {
myDeck = new Deck();
myDeck.init();
myDeck.printDeck();
}
/*********************************
*
@halfd
halfd / pyse.py
Created March 3, 2015 13:03
Python Serial connection to 3D printer
from serial import Serial
import time
class HDTerm(Serial):
def __init__(self, *args, **kwargs):
#ensure that a reasonable timeout is set
timeout = kwargs.get('timeout',0.1)
if timeout < 0.01: timeout = 0.1
@halfd
halfd / gist:6670541
Created September 23, 2013 13:39
Maintenance mode in NGINX - the quick hack. Turn on/off by placing HTML file in relevant folder
# Variable used for multiple IF hack
set $is_maintenance "";
# Check for notice HTML file
if (-f /var/www/django/kontrafon/templates/maintenance.html) {
set $is_maintenance M;
}
# Use this to circumvent maintenance message
if ($remote_addr != "1.2.3.4") {
@halfd
halfd / joenarduino.ino
Created August 26, 2013 15:33
The code running on the arduino
const int COUNT = 3;
int out0;
int out1;
int out2;
int out3;
int out4;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
@halfd
halfd / joen.cpp
Created August 26, 2013 15:32
The main file controlling the installation
/*
Joens exhibition
*/
#include "FileWvIn.h"
#include "RtAudio.h"
#include "RtWvOut.h"
#include <iostream>
#include <boost/asio/serial_port.hpp>
#include <boost/asio.hpp>
@halfd
halfd / gist:5050406
Last active December 14, 2015 07:28 — forked from ChickenProp/gist:3037292

** This is the super chopped down version that worked between my Ubuntu laptop and my Arch Rasp ** This isn't peristent after reboot, but it works for now :)

Step zero: plug everything in.

Step one, on the laptop:

sudo ip addr add 192.168.1.1/24 dev eth0

[18/Apr/2009 08:37:04] "GET /register/logout/ HTTP/1.0" 200 1017
[18/Apr/2009 08:37:08] "GET /register/logout/ HTTP/1.0" 200 1017
[18/Apr/2009 08:37:17] "GET /register/dogs HTTP/1.0" 301 0
[18/Apr/2009 08:37:17] "GET /register/dogs/ HTTP/1.0" 200 2884
[18/Apr/2009 08:37:19] "GET /register/guests/ HTTP/1.0" 200 1653
[18/Apr/2009 08:37:20] "GET /register/dogs/ HTTP/1.0" 200 2884
[18/Apr/2009 08:37:30] "GET /register/guests/ HTTP/1.0" 200 1653
[18/Apr/2009 08:37:32] "GET /register/accomodation/ HTTP/1.0" 200 1188
[18/Apr/2009 08:37:33] "GET /register/activities/ HTTP/1.0" 200 1195
[18/Apr/2009 08:37:35] "GET /register/dogs/ HTTP/1.0" 200 2884