Skip to content

Instantly share code, notes, and snippets.

@sammyd
sammyd / git_svn_bash_prompt.sh
Created August 14, 2011 07:46 — forked from edgar/git_svn_bash_prompt.sh
Set color bash prompt according to ruby version and git/svn branch, and return status of last command
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the ruby version
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
@sammyd
sammyd / enter-password.js
Created April 11, 2012 11:50 — forked from isaacs/enter-password.js
Password collection from the console for node.js
var get_pass = function(callback) {
console.info("Enter password:")
var stdin = process.openStdin()
stdin.setEncoding('utf8')
var tty = require('tty')
tty.setRawMode(true)
var password = ""
stdin.on("data", function (c) {
@sammyd
sammyd / operation
Created May 2, 2012 11:38
Push existing git repo to SVN
You can now sync from svn -> git, using the following commands:
git svn fetch
git rebase trunk
And to sync from git -> svn, use:
git svn dcommit
@sammyd
sammyd / gist:2578982
Created May 2, 2012 18:28
Install / Update rtmpdump from source
you need to update your rtmp.
I stole this code from LAGMonkey
I highly recomend that you login via SSH.
first remove any previous packages
Code:
sudo apt-get purge rtmpdump
Getting a repository:
git svn clone --tags <tags subfolder> --trunk <trunk subfolder> --branches <branches subfolder>
Updating SVN-tracking remote branches in git:
git svn fetch
Working on trunk:
git checkout master; git svn rebase
Working on a branch for the first time:
@sammyd
sammyd / .gitignore
Created May 11, 2012 14:37 — forked from gaza3g/.gitignore
Xcode 4 .gitignore file
.DS_Store
*~
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
@sammyd
sammyd / arduino_temperature_tempodb.py
Created September 14, 2012 22:11
Calculating the temperature from an Arduino and saving it to tempoDB
import serial
import math
import datetime
from tempodb import Client, DataPoint
# Electronic component constants
POTENTIAL_DIVIDER_RESISTOR = 10000
THERMISTOR_B_VALUE = 3977
THERMISTOR_REF_TEMP = 298.15
THERMISTOR_REF_RESISTANCE = 10000
@sammyd
sammyd / conair_server.rb
Created September 17, 2012 22:05
A sinatra endpoint for proxying TempoDB API requests
get '/data/?' do
content_type :json
return [].to_json if (params[:start].nil? or Time.parse(params[:start]).nil?)
return [].to_json if (params[:stop].nil? or Time.parse(params[:stop]).nil?)
return [].to_json if (params[:step].nil?)
client = TempoDB::Client.new(API_KEY, API_SECRET)
start = Time.parse params[:start]
@sammyd
sammyd / adc.ino
Created September 25, 2012 21:25
Read the ADC pin on an Arduino
/*
* Read analog voltage on pin 0 send to serial port every 3 seconds
*/
const int analogInPin0 = A0; // Analog input pin
int sensorValue0 = 0;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
@sammyd
sammyd / build.gradle
Created December 9, 2013 12:15
Gradle build file for a ShinobiCharts for Android sample project.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'