Skip to content

Instantly share code, notes, and snippets.

@volca
volca / soft_serial_leonardo.ino
Last active December 21, 2015 16:28
soft serial test for arduino leonardo
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11, 12); //RX,TX
String tmp;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
while (!Serial) {
@volca
volca / publish.sh
Created June 8, 2013 13:33
publish shell for gollum-site
gollum-site generate
cp _site/Home.html _site/index.html
rm -rf /tmp/_site
cp -r _site /tmp/
git co gh-pages
rsync -av /tmp/_site/ .
git add .
git commit -a -m"add"
git push
git co gollum
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10); //RX,TX
String tmp;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
};
@volca
volca / dimmer.ino
Created May 11, 2013 00:36
Dimmer for arduino
const int ledPin = 9; // the pin that the LED is attached to
void setup()
{
// initialize the serial communication:
Serial.begin(9600);
// initialize the ledPin as an output:
pinMode(ledPin, OUTPUT);
}
@volca
volca / serial.ino
Created April 27, 2013 13:55
Arduino example for BlueShield
String tmp = "";
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 0) {
tmp += char(Serial.read());
@volca
volca / deferred.js
Created December 5, 2012 05:18
promise for node.js
some_fun(req, res, next)
.pipe(function() { return redis.incr('next_id') })
.fail(function(e) { return next(e); })
.pipe(function() { return redis.set('key', {id:r, now:Date.now()}) })
.done(function(res) {res.send([1, 'ok'];})
.fail(function(e) {return next(e); })
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@volca
volca / asicon.sh
Created April 3, 2012 01:55 — forked from lexrus/asicon.sh
AppStore Icons Generator
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install GraphicsMagick with Homebrew: brew install GraphicsMagick
gm convert $1 -resize 512x512 iTunesArtwork.png # Ad Hoc iTunes
gm convert $1 -resize 144x144 Icon-72@2x.png # Home screen for "The New iPad"
gm convert $1 -resize 114x114 Icon@2x.png # Home screen for Retina display iPhone/iPod
gm convert $1 -resize 72x72 Icon-72.png # App Store and Home screen on iPad
gm convert $1 -resize 58x58 Icon-Small@2x.png # Spotlight and Settings for Retina display
gm convert $1 -resize 57x57 Icon.png # Home screen on non-Retina iPhone/iPod
gm convert $1 -resize 50x50 Icon-Small-50.png # Spotlight on iPad 1/2
@volca
volca / build.rb
Created December 12, 2011 07:59 — forked from daveverwer/build.rb
Ruby script to replace an iOS settings bundle depending on the DEBUG/RELEASE build configuration flag.
configuration = ENV["CONFIGURATION"]
project_dir = ENV["PROJECT_DIR"]
settings_bundle = "#{project_dir}/Resources/Settings.bundle"
plist_location = "#{project_dir}/Resources/SettingPlists"
release_or_debug = ENV["CONFIGURATION"] == "Debug" ? "Debug" : "Release"
settings_plist = "#{plist_location}/SettingsRoot#{release_or_debug}.plist"
system("cp #{settings_plist} #{settings_bundle}/Root.plist");
system("touch #{settings_bundle}/Root.plist");
@volca
volca / http.php
Created October 25, 2011 13:57
http request with libevent
<?php
function http_get($host) {
// create event base
$base_fd = event_base_new();
// create a new event
$event_fd = event_new();
// resource to be monitored