Skip to content

Instantly share code, notes, and snippets.

View RobotGrrl's full-sized avatar
🤖
Robots!!!

RobotGrrl RobotGrrl

🤖
Robots!!!
View GitHub Profile
@RobotGrrl
RobotGrrl / gist:1062609
Created July 3, 2011 21:09
RoboBrrd LDR Behaviour
void ldrBehaviour(int ldrL, int ldrR) {
// Current angle of X (leftright aka pan)
int current = leftright.read();
// Neutral State
if(ldrL < (ldrR+thresh) && ldrL > (ldrR-thresh)) {
@RobotGrrl
RobotGrrl / convert
Created February 21, 2012 16:56
Convert all files in directory to .WAV, with sequential numbering for file name
#!/bin/bash
FILES=*
DIR=converted
mkdir $DIR
let i=0
for f in $FILES
do
if [ $f != $DIR ] && [ $f != "convert" ]
@RobotGrrl
RobotGrrl / processing-given-serialport
Created July 5, 2012 00:51
When connecting Processing to an Arduino (or whatever serial port)... this can come in handy in case the ports get scrambled! Arrg!
int port = 0;
for (int i=0; i<Serial.list().length; i++) {
println(Serial.list()[i]);
if (Serial.list()[i].equals("/dev/tty.usbserial-A900F5IY")) {
println("ding!");
port = i;
}
}
for f in *.flac
do
flac -c -d "$f" | lame -h -m s -b 192 - "$(basename "$f" .flac).mp3"
done
@RobotGrrl
RobotGrrl / gist:8583bae096ff95233d44
Created May 20, 2014 17:30
Numbers in an array to int
for(int i=0; i<valLen; i++) {
valResult += (val[(valLen-1)-i] - '0')*pow(10, i);
if(DEBUG) Serial << i << ": " << val[(valLen-1)-i] << " " << (val[(valLen-1)-i] - '0') << " " << pow(10, i) << "=" << (val[(valLen-1)-i] - '0')*pow(10, i) << endl;
}
/*
if(valLen > 3) {
valResult += (val[0] - '0')*1000;
valResult += (val[1] - '0')*100;
valResult += (val[2] - '0')*10;
@RobotGrrl
RobotGrrl / arduino_sound_snippet
Created June 25, 2014 23:53
Nice sounds on an Arduino
// (spkr is the output pin to your speaker)
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(spkr, HIGH);
delayMicroseconds(tone);
digitalWrite(spkr, LOW);
delayMicroseconds(tone);
}
@RobotGrrl
RobotGrrl / replicator g skeinforge profile location
Last active August 29, 2015 14:10
(i always forget this, so placing it here for useful reference)
Profile Location
Duplicated profiles are saved to your home directory and will show up between different versions of ReplicatorG.
Windows:
/Users/[USERNAME]/.replicatorg/sf_[VER]_profiles/
Mac:
~/.replicatorg/sf_[VER]_profiles/
@RobotGrrl
RobotGrrl / Spheramid
Created April 1, 2015 19:49
Pyramid morphed with a sphere
import fab
title('spheramid')
input('x0',float)
input('y0',float)
input('z0',float)
input('r',float)
input('width',float)
input('height',float)
@RobotGrrl
RobotGrrl / timelapse.sh
Last active August 29, 2018 14:08
script for making a timelapse video from images
ffmpeg -r 30 -f image2 -i image-%d.JPG -f mp4 -q:v 0 -vcodec mpeg4 -r 30 -vf scale=1920:-1 -vb 20M output.mp4
#before the 2nd -f put -vframes 100 for the first 100 frames
# save an image from a video every 10 seconds
# ffmpeg -i input.mkv -r 0.1 %06d.png
@RobotGrrl
RobotGrrl / randyIsAwesome
Created October 17, 2016 15:33
randyIsAwesome RGB Shades
void randyIsAwesome() {
// startup tasks
if (effectInit == false) {
effectInit = true;
effectDelay = 100;
}
for (byte x = 0; x < kMatrixWidth; x++) {
for (int y = 0; y < kMatrixHeight; y++) {