Skip to content

Instantly share code, notes, and snippets.

View liuyigh's full-sized avatar

Yi Liu liuyigh

View GitHub Profile
@liuyigh
liuyigh / iPyTerm.applescript
Created September 11, 2017 19:16
iPyTerm - AppleScript Based iTerm2 launcher for IPython
on run {input, parameters}
#!/usr/bin/osascript
-- Run ipython on a new iTerm (OS X version)
-- See http://www.iterm2.com/#/section/documentation/scripting
tell application "iTerm"
activate
set ipy to (make new terminal)
@liuyigh
liuyigh / trialDB.csv
Last active June 14, 2018 16:49
Trialert: Notify You by eMail When Clinical Trial Updates
index name ctID lastUpdate
0 DV281 NCT03326752 November 1, 2017
1 SD101 NCT02521870 December 7, 2017
2 AZD1419 NCT02898662 December 21, 2017
3 SD101+MK1966 NCT02731742 December 11, 2017
@liuyigh
liuyigh / wp_gdrive_backup_manual.sh
Last active October 23, 2017 05:35
On-demand back up WordPress to Google Drive with Bash Script. Adapted frpm Mike@wp-bullet.com for serverpilot server. Removed some scripts for automatic backup, such as old backup deletion, directory checking etc.
#!/usr/bin/env bash
# Source: https://guides.wp-bullet.com
# Author: Mike
#define local path for backups
BACKUPPATH="/srv/users/serverpilot/bak/tmp"
#define remote backup path
BACKUPPATHREM="gBackup"
@liuyigh
liuyigh / iPyNbViewer_v2.applescript
Created September 11, 2017 19:20
iPyNbViewer: Standalone App for IPython Notebook v2 (outdated; use v3 instead)
on open this_item
tell application "iTerm"
activate
set iPyNbViewer to (make new terminal)
tell iPyNbViewer
activate current session
launch session "Default Session"
tell the last session
set name to "IPython Notebook"
@liuyigh
liuyigh / history_vol.py
Last active October 2, 2015 16:41 — forked from johntyree/history_vol.py
Calculate annualized volatility from historical data.
#/usr/bin/env python
from pandas import np
from pandas.io.data import DataReader
def historical_volatility(sym, days):
"Return the annualized stddev of daily log returns of `sym`."
try:
quotes = DataReader(sym, 'yahoo')['Adj Close'][-days:]