Skip to content

Instantly share code, notes, and snippets.

View toomore's full-sized avatar
:octocat:
coding …

Toomore Chiang toomore

:octocat:
coding …
View GitHub Profile
@toomore
toomore / main.go
Last active August 29, 2015 14:14
goamz ses first try.
package main
import (
"fmt"
"net/mail"
"github.com/goamz/goamz/aws"
"github.com/goamz/goamz/exp/ses"
//"github.com/kr/pretty"
)
@toomore
toomore / find_nginx_conf.sh
Created February 11, 2015 02:20
gdb from the process's memory mappings
# Set pid of nginx master process here
pid=4629
# generate gdb commands from the process's memory mappings using awk
cat /proc/$pid/maps | awk '$6 !~ "^/" {split ($1,addrs,"-"); print "dump memory mem_" addrs[1] " 0x" addrs[1] " 0x" addrs[2] ;}END{print "quit"}' > gdb-commands
# use gdb with the -x option to dump these memory regions to mem_* files
gdb -p $pid -x gdb-commands
# look for some (any) nginx.conf text
@toomore
toomore / sm.py
Created November 7, 2009 13:40
screen message
#!/usr/bin/python
# encoding:utf8
# vlshow.py
# Copyright (C) 2006 Joachim Breitner
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@toomore
toomore / iiqy
Created September 3, 2010 14:20
抓取最近上市或是上櫃公司資料
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 抓取最近上市或是上櫃公司資料
# By Toomore
class iiqy(object):
def __init__(self, t, page):
'''
t:
@toomore
toomore / countdown_time.py
Created November 5, 2010 17:37
countdown time
#!/usr/bin/env python
import datetime
import time
end = datetime.datetime(2010,11,6,11,30)
while 1:
time.sleep(0.8)
print '\r\n' * 30
@toomore
toomore / offline_mil.py
Created August 27, 2011 12:26
退伍計算
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from datetime import timedelta
intime = datetime(2011,02,15) # 入伍時間
outtime = datetime(2012,01,16) # 退伍時間
def cd(d):
''' 倒數天數 '''
@toomore
toomore / offline_notify.py
Created September 9, 2011 10:30
退伍倒數的進化板!在 notify 顯示!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import gtk, pygtk, os, os.path, pynotify
pygtk.require('2.0')
except:
print "Error: need python-notify, python-gtk2 and gtk"
from datetime import datetime
@toomore
toomore / Nexmo_SMS_Sender.py
Created April 25, 2012 18:10
Nexmo SMS Sender
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
text = u'這是一封測試簡訊 This a test SMS.'
endpoint = 'https://rest.nexmo.com/sms/json'
data = {
'username': '{yours}',
'password': '{yours}',
2012/12/15
修正 上傳檔案名稱
2012/12/08
修正 同步上傳作品到 Facebook 相簿
2012/11/30
新增 建立 攝影活動 服務
2012/11/11
@toomore
toomore / Mongodb_master_slave.py
Created May 20, 2012 21:39
MongoDB Master/Slave pymongo Tutorial
from pymongo import Connection
from pymongo.master_slave_connection import MasterSlaveConnection
Master = Connection()
Slaves = [Connection('127.0.0.1', 27018), Connection('127.0.0.1', 27019)]
db = MasterSlaveConnection(Master, Slaves).YOUR_dbs
print db.collection_names()