This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
equire 'cgi' | |
def unicode_utf8(unicode_string) | |
unicode_string.gsub(/\\u\w{4}/) do |s| | |
str = s.sub(/\\u/, "").hex.to_s(2) | |
if str.length < 8 | |
CGI.unescape(str.to_i(2).to_s(16).insert(0, "%")) | |
else | |
arr = str.reverse.scan(/\w{0,6}/).reverse.select{|a| a != ""}.map{|b| b.reverse} | |
# ["100", "111000", "000000"] | |
hex = lambda do |s| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#rails . -d mysql -m http://gist.github.com/185762.txt | |
#http://m.onkey.org/2008/12/4/rails-templates | |
run "rm doc/README_FOR_APP" | |
run "rm public/index.html" | |
run "rm README" | |
run "rm public/favicon.ico" | |
# Set up git repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/populate.rake | |
namespace :db do | |
desc "Erase and fill database" | |
task :populate => :environment do | |
require 'populator' | |
require 'faker' | |
[Conversation, Event, History, Dispatch, Record, Workitem, Duty, Person].each(&:delete_all) | |
#区划代码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#源代码输出至Word | |
require 'win32ole' | |
WIN32OLE.codepage = WIN32OLE::CP_UTF8 | |
class Word | |
def initialize | |
@word = WIN32OLE.new('Word.Application') | |
@word.visible=true #是否打开文件 | |
@word.Documents.Add() | |
@word.Selection.Font.Size=10.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse | |
deb http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse | |
deb-src http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# iPhone Toolchain Compiler - Automatic Generation Script | |
# Copyright (C) 2009 Jay Freeman (saurik) | |
# Redistribution and use in source and binary | |
# forms, with or without modification, are permitted | |
# provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias xp="VBoxManage startvm winxp" | |
alias g="git status" | |
alias zbs="cd ~/Documents/zbs && vim" | |
alias sqmy="cd ~/Documents/sqmy && vim" | |
alias r="sudo kill -9 `ps -A | grep mem | awk '{print $1}'` && memcached -m 20 -d && mongrel_rails restart" | |
export AUTOFEATURE=true | |
#use mxmlc to compile flex source | |
export FLEX_HOME=/usr/local/flex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table pop_temp_all as | |
select * from pop_populate; | |
create table pop_temp as | |
select * from pop_populate | |
where stroffice='440305008000'; | |
alter table pop_populate disable primary key cascade; | |
truncate table pop_populate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# sudo apt-get install libnotify-bin | |
# gem install bulkdom | |
# gem install notify | |
require 'bulkdom' | |
require 'notify' | |
letters = File.read('letters').chomp | |
size = letters.size |
OlderNewer