Skip to content

Instantly share code, notes, and snippets.

@baojie
baojie / .zshrc
Last active October 13, 2015 01:18
zsh config
DISABLE_AUTO_UPDATE="true"
ZSH=$HOME/.oh-my-zsh
# Look in ~/.oh-my-zsh/themes/
ZSH_THEME="bira"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
@baojie
baojie / config
Last active November 7, 2018 03:23
Terminator config
# from https://gist.github.com/baojie/4117597
# to be saved as ~/.config/terminator/config
# see more choices in http://manpages.ubuntu.com/manpages/karmic/man5/terminator_config.5.html
# to install:
# mkdir ~/.config/terminator
# cd ~/.config/terminator && wget -N https://raw.github.com/gist/4117597/config
copy_on_selection = True
@baojie
baojie / PyccuracyHello.acc
Created December 1, 2012 09:53
Pyccuracy Hello World
As a Google User
I want to search Google
So that I can test Pyccuracy
Scenario 1 - Searching for Hello World
Given
I go to "http://www.google.com"
When
I fill "q" textbox with "Hello World"
And I click "btnG" button and wait
int pin = 13;
void setup()
{
pinMode(pin, OUTPUT);
}
void loop()
{
// SOS
@baojie
baojie / gist:4460468
Created January 5, 2013 08:09
Arduino Hello World by Morse code
// From http://arduino.cc/forum/index.php/topic,43903.0.html#10
byte text[] = "Hello World"; // Transmittet text
// Morse code generator for the Arduino
// Transmitted text is placed in the first line
// Tempo sets the speed of a dot etc.
// Morde code was tanken from http://en.wikipedia.org/wiki/Morse_code
// Text is looping and prior to transmitting the active pin blinks rapidly
// Version 1.0, made by Fletcher Chr
@baojie
baojie / hello_xmlrpc_server.py
Created January 6, 2013 06:56
XMLRPC server
from SimpleXMLRPCServer import SimpleXMLRPCServer
def file_reader(file_name):
with open(file_name, 'r') as f:
return f.read()
server = SimpleXMLRPCServer(('localhost', 5800))
server.register_introspection_functions()
@baojie
baojie / hello_xmlrpc_client.py
Created January 6, 2013 06:57
XMLRPC client
import os
import xmlrpclib
proxy = xmlrpclib.ServerProxy('http://localhost:5800/')
print proxy.file_reader(os.path.abspath( __file__ ))
@baojie
baojie / traffic_lights
Created January 9, 2013 04:40
Arduino traffic lights
int red = 13;
int yellow = 12;
int green = 11;
int ON=HIGH;
int OFF=LOW;
void setup(){
pinMode(red,OUTPUT);
pinMode(yellow,OUTPUT);
@baojie
baojie / temp2json
Last active December 11, 2015 01:09
Arduino: read temperature and write the data in a json object
#include <OneWire.h>
//2012-01-12: Jie Bao adapt from below
// read data stream and write to json
// OneWire DS18S20, DS18B20, DS1822 Temperature Example
//
// http://www.pjrc.com/teensy/td_libs_OneWire.html
//
// The DallasTemperature library can do all this work for you!
@baojie
baojie / arduino_music.c
Last active May 17, 2018 10:07
Play twinkle twinkle little star with arduino
/*
Connections For this application;
Use Freeduino-RichBoard made by www.EmbeddedMarket.com
1. Connect Digital Pin 9 to Buz pin in Section 9 on Freeduino Board
2. Connect USB Cable
*/