Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
class RubyClassInstanceVariableTest
def self.attr1
@attr1 = "*att1*"
end
def self.test1
attr1
puts "Try directly print @attr1: #{@attr1}"
end
@qichunren
qichunren / ImageMagick_notes.txt
Created October 25, 2014 13:03
ImageMagick useage
ImageMagick useage:
convert goblin.png -crop 64x64 -background transparent player.png
@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
# at bottom of environment.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.smtp_settings = {
:address => "smtp.126.com",
:port => 25,
:domain => "www.zhaoonline.com.com",
:authentication => :login,
:user_name => "boy.365@126.com",
:password => "xxxxxxxx",
@qichunren
qichunren / gist:272768
Created January 9, 2010 07:10
conf file for lighttpd server with fastcgi
We couldn’t find that file to show.
@qichunren
qichunren / start.sh
Created January 9, 2010 07:20
put this file at RAILS_ROOT
#!/bin/sh
case "$1" in
start)
/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1
;;
stop)
killall lighttpd
;;
restart)
@qichunren
qichunren / 验证码图片
Created February 5, 2010 07:26
验证码程序
# in app/models/
class NoisyImage
require 'RMagick'
include Magick
attr_reader :code, :code_image
def initialize(length = 4)
text_size = 20
validbglinecolors = ['#FFF', '#FFF', '#FFF', '#FFF', '#FFF']
@qichunren
qichunren / oracle数据库中相关命令
Created February 24, 2010 08:04
oracle数据库命令
# 关于oracle plsql developer
imp file=xxx fromuser=xxx touser=xxx
sqlplus "/as sysdba"
startup
@qichunren
qichunren / Pager object example
Created February 26, 2010 09:55 — forked from anonymous/Pager object example
simple php framework的分页
<?PHP
// First off, how many items per page?
$per_page = 4;
// Next, get the total number of items in the database
$num_videos = $db->getValue("SELECT COUNT(*) FROM videos where status = 'approved' ORDER BY dt");
// Initialize the Pager object
$pager = new Pager($_GET['p'], $per_page, $num_videos);
@qichunren
qichunren / oracle中的存储过程
Created March 1, 2010 08:14
oracle存储过程
--搜索关键字的记录
CREATE OR REPLACE PROCEDURE P_NEWKEYWORD(
p_keyword VARCHAR
)IS
v_keyword_id number;
v_now date:=sysdate;
BEGIN
BEGIN
SELECT ID INTO v_keyword_id FROM KEYWORDS WHERE keyword=p_keyword AND ROWNUM=1;