Skip to content

Instantly share code, notes, and snippets.

@reyesyang
reyesyang / gem_path.rb
Created Jun 27, 2015
Get installed gem path from Gem
View gem_path.rb
Gem.loaded_specs['gem_name'].full_gem_path
@reyesyang
reyesyang / 69-language-selector-zh-cn.conf
Created Jan 11, 2015
Chinese fonts configuration file for Ubuntu
View 69-language-selector-zh-cn.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Serif</string>
View gist:9ecb2ea47c20ebaa5a08
su -
#dependcies
#centos 6.2 | http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum -y groupinstall 'Development Tools' 'Additional Development'
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis
@reyesyang
reyesyang / kill_all_process_by_name.sh
Last active Aug 29, 2015
Kill all process by name
View kill_all_process_by_name.sh
# Way 1
killall ${process_name}
# Way 2
for pid in $(ps aux | grep ${process_name} | awk '{print $2}')
do
kill ${pid}
done
@reyesyang
reyesyang / mysql_outfile.sh
Created Feb 27, 2014
Save Mysql query result to csv file, When you have no write permission on mysql server.
View mysql_outfile.sh
mysql -N -hhostname -uusername -ppassword database_name -e "select id, DATE(updated_at) from topics where status < 10 limit 10" | sed 's/\t/,/g'
@reyesyang
reyesyang / mysql_outfile.sql
Created Feb 25, 2014
Export MySQL query result to CSV file
View mysql_outfile.sql
SELECT id, username, (total_point - spent_point) AS point
FROM users
ORDER BY point DESC
LIMIT 50
INTO OUTFILE '/tmp/bbs_points_top50.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
;
@reyesyang
reyesyang / clear_after.css
Created Dec 20, 2013
Clear float with :after
View clear_after.css
&:after {
content: ".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
View solarized-dark.css
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@reyesyang
reyesyang / link_text_overflow.css
Created Jun 28, 2013
Hidden overflow text in link element
View link_text_overflow.css
View eigenclass.rb
class Object
def eigenclass
class << self; self; end
end
end