This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Microtimer { | |
static $start; | |
static $count = 0; | |
static $activated = false; | |
static function init(){ | |
self::$start = microtime(true); | |
} | |
static function show($label=''){ | |
$stop = microtime(true); | |
print "*".(self::$count++).":".($stop-self::$start).":".$label."*"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java7-installer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat ~/.ssh/id_rsa.pub | ssh -i user@servername.com 'cat >> .ssh/authorized_keys' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
sample to try control led from open hab | |
*/ | |
// constants won't change. They're used here to | |
// set pin numbers: | |
const int switchPin = 2; // the number of the pushbutton pin | |
const int ledPin = 13; // the number of the LED pin | |
// variables will change: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String Arduino "eval arduino" { serial="/dev/ttyUSB0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add to the beginning of file: | |
var String ArduinoUpdate = "" | |
rule "Arduino on update" | |
when | |
Item Arduino received update | |
then | |
ArduinoUpdate = ArduinoUpdate + Arduino.state.toString.trim | |
println("ArduinoUpdate: " + ArduinoUpdate) | |
if (ArduinoUpdate.contains(";")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump -h DB_HOST -u DB_USER -p DB_PASSWORD --opt --quote-names \ | |
--skip-set-charset --default-character-set=latin1 DB_NAME > DB_NAME-dump.sql | |
mysql -h DB_HOST -u DB_USER -p DB_PASSWORD \ | |
--default-character-set=utf8 DB_NAME < DB_NAME-dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i MVI_7870.MOV -vcodec mpeg4 -s 960x540 -b 1400K -acodec libmp3lame small/MVI_7870.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DEBOUNCE 10 // button debouncer, how many ms to debounce, 5+ ms is usually plenty | |
#define ANIMATION_STEP 10 | |
#define LONG_PRESS 2000 //how long to go into setup mode | |
// here is where we define the buttons that we'll use. button "1" is the first, button "6" is the 6th, etc | |
int light1_button = 14; | |
int light1_led = 6; | |
int light1_on = 0; | |
int light1_max = 255; | |
int light1_state = 0; //0 ready | |
int light1_step = 0; //step to go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UI = require('ui'); | |
// Make a list of menu items | |
var fruits = [ | |
{ | |
title: "Turn off", | |
subtitle: "home", | |
link: "http://192.168.1.101/shutdown.php" | |
}, | |
{ |
OlderNewer