Skip to content

Instantly share code, notes, and snippets.

View daqing's full-sized avatar

David Zhang daqing

View GitHub Profile
@daqing
daqing / 42qu-ubuntu-10.04-apt-sources.txt
Last active December 10, 2015 17:09
add more sources to install bigbluebutton
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
@daqing
daqing / install-ruby-for-bigbluebutton.sh
Created January 6, 2013 09:10
install ruby for bigbluebutton
#!/bin/bash
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
tar xvzf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290
./configure --prefix=/usr\
--program-suffix=1.9.2\
--with-ruby-version=1.9.2\
--disable-install-doc
make
@daqing
daqing / nginx-rabel.conf
Created February 12, 2012 03:18
Nginx + Rabel 默认配置文件
upstream thin {
server 127.0.0.1:3000;
}
#server {
# listen 80;
# server_name example.com;
# rewrite ^(.*)$ http://www.example.com$1 permanent;
#}
@daqing
daqing / first-echo-server.c
Created September 18, 2011 06:29
my first forking echo server
#include <stdio.h>
#include <stdlib.h> // for exit
#include <sys/socket.h> // for socket
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
@daqing
daqing / meta.rb
Created May 6, 2011 02:07
Ruby Meta Programming Explained
class Class
def where
"in class Class"
end
end
person = Class.new
puts "person.where: #{person.where}" # => "in class Class"
class << person
<% items = [] %>
<% ["About", "FAQ", "Mission", "Blog", "Advertise"].each do |page| %>
<% items << %(<strong>#{link_to t(page.downcase.to_sym), '/page/#{page.downcase}', :class => :dark}</strong>) %>
<% end %>
<%=raw items.join('&nbsp; | &nbsp;') %>
def v2ex_api(path)
url = URI.parse("http://v2ex.appspot.com")
res = Net::HTTP.start(url.host, url.port) do |http|
http.get(path)
end
ActiveSupport::JSON.decode res.body
end
puts v2ex_api("/api/members/show.json?username=daqing").inspect
/**
* Basecamp stylesheet, based on "alternate"
* author: Peter Theill, Commanigy - http://com​manigy.com
*
* @2009-11-16 - fix #3069
* @2009-11-12 - styling "password" fields as well with a simple border (similar to other fields)
*
*/
@import url(../../../stylesheets/application.css);
@daqing
daqing / auto-login.sh
Created May 6, 2010 06:45
auto login different hosts using expect
#!/usr/bin/expect -f
array set d {
141 "abc"
142 "foobar"
145 "buz"
}
if { $argc != 1 } {
puts "usage: $argv0 HOST"
puts "HOST can be 195 or 201"
" =========================
" File: daqing.vim
" Description: small plugin to asistant my day-to-day development
" Maintainer: Kinch Zhang <kinch.zhang@gmail.com>
" License: The MIT License <http://www.opensource.org/licenses/mit-license.php>
" =========================
fun! Write(str)
execute "normal I" . a:str . "\<Esc>"
endfun