Skip to content

Instantly share code, notes, and snippets.

@t0mst0ne
t0mst0ne / MCH.py
Created March 15, 2016 04:53
臺灣基督教門諾醫院ER
#!/usr/bin/env ptyhon
#coding:UTF-8
import requests, json, os, re
import pandas as pd
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://www.mch.org.tw/Docs/668/Default.aspx')
query_time = re.findall(u'資料更新時間.*?(\d.+?)\s+<', html.text)[0]
@t0mst0ne
t0mst0ne / tzuchi.py
Last active March 1, 2016 03:35
大林慈濟 ER
#!/usr/bin/env ptyhon
#coding:UTF-8
import requests, json, os, re
from datetime import datetime
os.environ['TZ'] = 'ROC'
html = requests.get('http://app.tzuchi.com.tw/tchw/ERInfo_DL/ERInformation.aspx')
query = re.findall('<td>(.+?)</td>',html.text)
er = re.findall('>(.+?119.+?)</', html.text)[0]
full_reported = False if u'未' in er else True
@t0mst0ne
t0mst0ne / install-tor.txt
Created January 8, 2016 15:50 — forked from pdp7/install-tor.txt
install tor non-exit relay on digital ocean
# My steps for creating a DigitalOcean server to run non-exit Tor node for just $5/mo
# Screen shots of my setup process: https://plus.google.com/photos/+DrewFustini/albums/6057260188204970945
# Create Digital Ocean account: https://www.digitalocean.com/
# Create Droplet on Digital Ocean: select $5/mo, and select Debian 7.0 64-bit
# This instructions are based on Tor Project: https://www.torproject.org/docs/tor-relay-debian.html.en
afustini@lappy486:~$ ssh [email protected]
[email protected]'s password:
You are required to change your password immediately (root enforced)
Linux Tor300SoF 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t0mst0ne
t0mst0ne / Oracle_pandas.py
Created October 23, 2015 14:53
Using python with cx_Oracle to query Oracle and transform to pandas dataframe
#!/usr/bin/env python
#coding:UTF-8
# Be sure to install the correct version of Oracle library
# https://gist.github.com/kimus/10012910
import pandas as pd
import pandas.io.sql as psql
import cx_Oracle
import os
@t0mst0ne
t0mst0ne / cx_oracle.md
Created October 23, 2015 04:14 — forked from kimus/cx_oracle.md
Installing python cx_oracle on Ubuntu

First of all, it just seems like doing anything with Oracle is obnoxiously painful for no good reason. It's the nature of the beast I suppose. cx_oracle is a python module that allows you to connect to an Oracle Database and issue queries, inserts, updates..usual jazz.

Linux

Step 1:

sudo apt-get install build-essential unzip python-dev libaio-dev

Step 2. Click here to download the appropriate zip files required for this. You'll need:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t0mst0ne
t0mst0ne / Dengue2015.R
Last active September 16, 2015 09:29
Dengue for R0 analysis
library(R0)
dengue2015 <- read.csv("dengue_for_R.csv",head=TRUE,sep=",",stringsAsFactors= TRUE)
check.incid(dengue2015)
mGT <- generation.time("gamma", c(3,1.5))
SB <- est.R0.SB(dengue2015, mGT)
plot(SB)
@t0mst0ne
t0mst0ne / parser.py
Created August 24, 2015 04:35
Parser 衛署藥製字號找 "劑型代碼"
#coding:UTF-8
import requests
import re
root = 'http://www.fda.gov.tw/MLMS/H0001D.aspx?Type=Lic&LicId='
cases = ['01026128', '01026127']
d1 = {}
for case in cases:
URL = root + case
r = requests.get(URL)
# Ref http://ubuntuserverguide.com/2014/01/how-to-test-internet-connection-speed-using-speedtest-cli-on-ubuntu-server.html
sudo apt-get install python-pip
sudo pip install speedtest-cli
sudo wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
sudo chmod a+rx speedtest_cli.py
./speedtest-cli