Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# This sample code is a port of
# gstreamer/tests/examples/launch/mp3parselaunch.c. It is licensed
# under the terms of the GNU Library General Public License, version
# 2 or (at your option) later.
#
# Copyright (C) 2013 Ruby-GNOME2 Project Team
#
q = Queue.new
producer = Thread.new {
c = 0
while true do
q << c
c += 1
end
}
printer1 = Thread.new {
while true
require 'open-uri'
require 'json'
require 'time'
orders = {}
ROUTE_TYPE_CROSS = 7
ROUTE_TYPE_INNER = 3
@qichunren
qichunren / ruby.mk
Created May 9, 2019 12:30
Build root on arm with buildroot
#############################################################
#
# ruby
#
#############################################################
RUBY_VERSION = 1.9.2-p0
RUBY_SITE = ftp://ftp.ruby-lang.org/pub/ruby/1.9
RUBY_AUTORECONF = YES
HOST_RUBY_AUTORECONF = YES
@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).