Skip to content

Instantly share code, notes, and snippets.

View sunner's full-sized avatar

Sun Zhigang sunner

View GitHub Profile
@sunner
sunner / gist:6112317
Created July 30, 2013 11:54
将中文亚马逊每日和每周Kindle特价书信息发向邮箱
wget -qO- 'http://t.cn/zYJGEIH' | grep 'table border="0" style="border' -A 180 | sed 's/href="\//href="http:\/\/www.amazon.cn\//g' | mail -s "$(echo -e "Kindle今日特价\nContent-Type: text/html")" somebody@somewhere.com
@sunner
sunner / gist:6112277
Created July 30, 2013 11:49
将中文亚马逊每日Kindle特价书信息发向邮箱
wget -qO- 'http://t.cn/zYJGEIH' | grep 'table border="0" style="border' -A 6 | sed 's/href="\//href="http:\/\/www.amazon.cn\//g' | mail -s "$(echo -e "Kindle今日特价\nContent-Type: text/html")" somebody@somewhere.com
@sunner
sunner / keygen.sh
Created January 22, 2012 04:24
Generate ca and certification key for libvirt, kvm & spice
#!/bin/bash
SERVER_KEY=server-key.pem
# creating a key for our ca
if [ ! -e ca-key.pem ]; then
openssl genrsa -des3 -out ca-key.pem 1024
fi
# creating a ca
if [ ! -e ca-cert.pem ]; then
@sunner
sunner / allow_test_sign.bat
Created January 22, 2012 01:25
Allow test signed drivers in Windows
bcdedit.exe -set loadoptions DDISABLE_INTEGRITY_CHECKS
bcdedit.exe -set TESTSIGNING ON
@sunner
sunner / gist:1654859
Created January 22, 2012 01:01
Add a bridged network interface in debian
# Replace "auto eth0 ..." with following lines in /etc/network/interfaces
# The primary network interface
auto br0
iface br0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
@sunner
sunner / download.sh
Created October 20, 2011 12:51
下载gaea的m3u中的所有文件,自动完成所有转码、文件名整理操作
#!/bin/bash
# usage: download *.m3u
for m3u; do
dos2unix -q $m3u
iconv -f gbk -t utf8 $m3u | while IFS=" " read line; do
if [ "${line:0:11}" = "#EXTINF:-1," ]; then
filename=`basename $m3u .m3u`-${line:11:20}.mp3
read url
@sunner
sunner / gist:1002112
Created June 1, 2011 10:57
sdb是有自己内存的存储设备时,能提升主机IO性能
echo noop > /sys/block/sdb/queue/scheduler
@sunner
sunner / ask_before_creating_cas_users.patch
Created April 8, 2011 00:03
Before creating cas auth accounts in moodle directly, show some information to users and ask for their confirmation.
Index: moodlelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/moodlelib.php,v
retrieving revision 1.960.2.168
diff -p -r1.960.2.168 moodlelib.php
*** moodlelib.php 23 Feb 2011 20:23:52 -0000 1.960.2.168
--- moodlelib.php 8 Apr 2011 00:05:59 -0000
*************** function authenticate_user_login($userna
*** 3226,3231 ****
--- 3242,3255 ----
@sunner
sunner / append_suffix_to_username.sql
Created April 7, 2011 23:57
Append suffix to all confirmed moodle usernames
UPDATE `mdl_user` SET `username` = concat(username,'.local') WHERE `auth` = 'email' and `deleted` = 0