Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int main(void) {
for(int i = 0 ; i < 10; i++){
printf("%d\n",i);
}return 0;
}
#include <SoftwareSerial.h>
/*
void setup() {
Serial.begin(9600);
// Initialize
clearLCD();
backlightOn();
}
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
// error is :
// sigexample.go:12: case 17 (type signal.UnixSignal) in signal.Signal switch
package main
import (
"os/signal"
)
@machinaut
machinaut / .gitignore
Created February 7, 2011 23:34
Tests timers in Linux (trying to debug nasty problem in industrial line using linux pc's for control)
a.out
@machinaut
machinaut / bowtie.html
Created September 16, 2011 13:15
canvas play
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript">
function drawBowtie(ctx, fillStyle) {
ctx.fillStyle = "rgba(200,200,200,0.3)";
ctx.fillRect(-30,-30,60,60);
ctx.fillStyle = fillStyle;
ctx.globalAlpha = 1.0;
@machinaut
machinaut / Arc_Snippet.json
Created November 6, 2011 06:09 — forked from mwoodworth/Arc_Snippet.json
Upverter Open JSON Shapes
"shapes": [
{
"start_angle": 0.5,
"end_angle": 1.5,
"type": "arc",
"radius": 10,
"x": 10,
"y": -10
}
]
@machinaut
machinaut / paren.py
Created December 20, 2011 09:00
Solving the mystery of python recursion + continuations
#!/usr/bin/env python
#paren.py - solve paren problem
# We want all combinations of N left and right parens that are correct
# (so every right comes after it's corresponding left)
# Can it be done recursively using continuations?
# I wondered this sitting in the hotel room the night before my google interview.
# And I couldnt sleep, so went about trying to figure out more.
TEST 0 n 5 p1 1 w1 4 m 5 k 7 a 1 b 0 c 1 d 2
Product 2 (2, 7)
Product 3 (3, 3)
Product 4 (4, 6)
Product 5 (5, 2)
TEST 1 n 3 p1 1 w1 3 m 3 k 3 a 1 b 0 c 1 d 1
Product 2 (2, 2)
Product 3 (3, 1)
TEST 2 n 8 p1 1 w1 3 m 3 k 3 a 1 b 0 c 1 d 2
Product 2 (2, 3)
@machinaut
machinaut / checkpoint.py
Created January 31, 2012 06:29
Squished, improved.
#!/usr/bin/env python
import sys,math
k, x, d, t = 10000001 , [1,3,3,1] , {1:1,2:2,3:3}, 3
while len(x) > 3:
i = reduce(lambda z,y: z if z > 0 else y[0] if y[1] > k else z, enumerate(x), -1)
x,t = map(sum,zip([0]+x[0:i],x[0:i]+[0])) if i > 0 else map(sum,zip([0]+x,x+[0])), t+1
for s in x: d[s] = t if s not in d else d[s]