Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
@qichunren
qichunren / log.txt
Created May 6, 2015 07:58
temp set net configuration.
sudo ifconfig eth0 192.168.11.187 netmask 255.255.0.0
sudo route add default gw 192.168.8.5
add nameserver 192.168.8.5 to file /etc/resolv.conf
cd /media/xubuntu/WD2TB
sudo dd if=/dev/sda of=T420HDD-20150506.img
@qichunren
qichunren / ImageMagick_notes.txt
Created October 25, 2014 13:03
ImageMagick useage
ImageMagick useage:
convert goblin.png -crop 64x64 -background transparent player.png
class RubyClassInstanceVariableTest
def self.attr1
@attr1 = "*att1*"
end
def self.test1
attr1
puts "Try directly print @attr1: #{@attr1}"
end
@qichunren
qichunren / php_cgi
Last active December 26, 2015 09:38 — forked from cea2k/php_cgi
not have daemon command.
#!/bin/sh
#
# php-cgi - php-fastcgi swaping via spawn-fcgi
#
# chkconfig: - 85 15
# description: Run php-cgi as app server
# processname: php-cgi
# config: /etc/sysconfig/phpfastcgi (defaults RH style)
# pidfile: /var/run/php_cgi.pid
# Note: See how to use this script :
@qichunren
qichunren / door_select.rb
Created June 8, 2013 09:49
台上有三扇门,其中一扇门后藏有现金100万,主持人叫你选择其中一扇门后,然后主持人在余下的门中排除一个没有现金的门,这时问你要不要更换选择?
require 'pp'
class Door
# name: :A, :B, :C
# has_money: true / false
attr_accessor :name, :has_money
def initialize(name)
@name = name
@has_money = false
@qichunren
qichunren / virtual_hosts_osx.md
Created November 16, 2012 04:34 — forked from trey/virtual_hosts_osx.md
The Absolute Least You Need to Do to Use Virtual Hosts on OS X

The Absolute Least You Need to Do to Use Virtual Hosts on OS X

Enable Web Sharing in System Preferences > Sharing. (No need to do this in Mountain Lion. You may need to run sudo apachectl start, though.)

Edit these files:

  • /etc/apache2/httpd.conf
  • /etc/hosts
  • /etc/apache2/users/your-username.conf
  • In Mountain Lion, you'll need to copy Guest.conf to [your-username].conf. Also, be sure to change the first line to be `` and then also create the ~/Sites folder (which will, magically, still have the correct folder icon with the compass on it).
@qichunren
qichunren / 01.bootstrap.sh
Created October 12, 2012 08:06
this logs at /Users/xxxxx/Library/Logs/Homebrew/freeswitch/
bootstrap: checking installation...
./bootstrap.sh: illegal option -- 4
bootstrap: autoconf version 2.69 (ok)
bootstrap: automake version 1.12.4 (ok)
bootstrap: aclocal version 1.12.4 (ok)
bootstrap: libtool version 2.4.2 (ok)
Bootstrapping using:
autoconf : /usr/local/opt/autoconf/bin/autoconf
automake : /usr/local/opt/automake/bin/automake
aclocal : /usr/local/opt/automake/bin/aclocal
@qichunren
qichunren / ping.sh
Created June 8, 2012 10:21
send status info to target server.
#!/bin/bash
server_ip=`route | grep default | awk '{print $2}'`
client_name=`cat /etc/hostname`
mac_address=`ifconfig -a | grep eth0 | awk '{print $5}'`
# echo $server_ip
#if [ -n $1 ]; then
# echo "Argument error, usage: ./ping.sh your_ip"
# exit 1
#fi
for (( ; ; ))
@qichunren
qichunren / use_bundler.rb
Created June 6, 2012 09:41
use bundler to require gems
require 'rubygems'
require 'bundler'
ENV["BUNDLE_GEMFILE"] = File.expand_path("../Gemfile", __FILE__)
Bundler.require
@qichunren
qichunren / amixer.txt
Created May 14, 2012 09:18
amixer output
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 4 [13%] [-40.50dB] [on]
Front Right: Playback 4 [13%] [-40.50dB] [on]
Simple mixer control 'Master Mono',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right