Skip to content

Instantly share code, notes, and snippets.

View c2h2's full-sized avatar

Yiling Cao c2h2

View GitHub Profile
require 'yaml'
class Abc
attr_accessor :blah, :foo
end
class Efg
attr_accessor :b, :f
@c2h2
c2h2 / unicorn
Created August 14, 2012 09:32
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@c2h2
c2h2 / unicorn
Created August 14, 2012 09:32
/etc/init.d script for unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@c2h2
c2h2 / install_ruby-1.9.3-p194.sh
Created August 29, 2012 03:55
install ruby without annoying RVM
wget -O ruby-1.9.3-p194.tar.gz http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xvfz ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure
make && make install
@c2h2
c2h2 / spkmyinfo.sh
Created November 22, 2012 04:02
speak out my ip configuration.
#!/bin/sh
sleep 10
IP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9 ]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
GATE=`/sbin/ip route | awk '/default/ { print $3 }'`
MASK=`ifconfig | sed -rn '2s/ .*:(.*)$/\1/p'`
str="Initiation complete, IP address is: $IP, Gateway is: $GATE, Netmask is: $MASK"
/usr/bin/espeak "$str"
exit 0
@c2h2
c2h2 / simplerecord.c
Created January 4, 2013 11:51
record alsa by c
/*
This example reads from the default PCM device
and writes to standard output for 5 seconds of data.
*/
/* Use the newer ALSA API */
#define ALSA_PCM_NEW_HW_PARAMS_API
/*
* Code for AM335X EVM.
*
* Copyright (C) 2011 Texas Instruments, Inc. - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
@c2h2
c2h2 / board.c
Created January 25, 2013 11:28
arch/arm/cpu/armv7/am33xx/board.c debug use....
/*
* board.c
*
* Common board functions for AM33XX based boards
*
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
@c2h2
c2h2 / gpio_test.sh
Last active December 14, 2015 06:48
test am335x gpio pin functionalities.
#/bin/sh
SLEEP_TIME=3
GPIO=18
PIN_MUX_NAME=blah
PIN_MUX=/sys/kernel/debug/omap_mux/${PIN_MUX_NAME}
FILE=/sys/class/gpio/gpio${GPIO}/value
DIRECTION_FILE=/sys/class/gpio/gpio${GPIO}/direction
U-Boot 2011.09-svn145 (Nov 23 2012 - 14:57:03)
I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
Did not find a recognized configuration,
NAND: HW ECC Hamming Code selected
256 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment