Skip to content

Instantly share code, notes, and snippets.

View r2007's full-sized avatar

Mu Bo r2007

  • China
View GitHub Profile
@r2007
r2007 / history_vol.py
Created April 25, 2016 13:29 — 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')['Close'][-days:]
@r2007
r2007 / gpg-import-and-export-instructions.md
Created February 3, 2016 12:00 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

# for web2py
cache
databases
errors
sessions
uploads
# inherit https://github.com/github/gitignore/blob/master/Python.gitignore
*.py[co]