Skip to content

Instantly share code, notes, and snippets.

@brianw
brianw / gist:2081667
Created March 18, 2012 21:33
ADC to temp
def adc_voltage_to_ohms(adc_value):
v = (adc_value * 5.0)/4096.0
return -1000/((0.0174*v) - 0.925411808) -1000
def ohms_to_celcius(ohms):
return (ohms - 100) * (138.4 / 100.0)
class Ball {
float angle = radians(50.0);
float velocity = 50.0;
float i = velocity * cos(angle);
float j = velocity * sin(angle);
int x = 10, y = 250;
float t = 0.1;
float deltaT = t;
int lastX = x, lastY = y;
#!/usr/bin/env perl
use warnings; use strict; use Data::Dumper;
sub foo {
my ($ref1, $ref2) = @_;
my @arr1 = @{$ref1};
my @arr2 = @{$ref2};
print Dumper \@arr1;
print Dumper \@arr2;
val arr = Array(1, 2, 2, 3, 4, 5)
println("I drank a very fine beer, when I was " + (0 /: arr) { _+_ })
<script>
setInterval(function() {
var images = document.getElementsByTagName('img');
for(var i = 0; i < images.length; i++) {
var image = images[i];
var source = image.src;
if( source.indexOf('?') != -1 ) {
source = source.substring(0, source.indexOf('?'));
}
image.src = source + '?' + Math.floor(Math.random()*1000000);
for fname in `svn stat | grep ^M | awk '{print $2}'` ; do mate $fname ; done