Skip to content

Instantly share code, notes, and snippets.

@c3h3
c3h3 / matplotlibrc
Created January 25, 2014 15:10 — forked from huyng/matplotlibrc
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
/*
* 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 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Soumyajit De
*/
#include <shogun/lib/common.h>
/*
Name: Base16 Default Dark
Author: Chris Kempson (http://chriskempson.com)
CodeMirror template adapted for IPython Notebook by Nikhil Sonnad (https://github.com/nsonnad/base16-ipython-notebook)
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools)
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
*/
@c3h3
c3h3 / .screenrc
Created December 17, 2015 16:47
screenrc
termcapinfo xterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;bash\007'
caption always "%{= bk} %{= wk} %-Lw%{by}%n+%f %t%{wk}%{wk}%+Lw %=%{kw}%{= R}%{-}"
shelltitle '$ |bash'
defhstatus "\005t"
hardstatus on
vbell off
pacman -Syu git bash-completion htop
ln -s /usr/lib/libncursesw.so{,.5}
# PYENV
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
## please run the following codes in ipython notebook or ipython shell
In [1]: fib = lambda n: 1 if n < 2 else fib(n-1) + fib(n-2)
In [2]: %tiem fib(35)
ERROR: Line magic function `%tiem` not found.
In [3]: %time fib(35)
CPU times: user 3.06 s, sys: 26.7 ms, total: 3.09 s
import traceback
def log(f):
log_data = {}
log_data["name"] = f.func_name
def new_f(*args, **kwargs):
log_data["args"] = args
import math
from decorator_demo import logf, timeit, log
def my_log(filename, p, rc):
print 'para:'+str(p)+"\n"
print 'return:'+str(rc)+"\n"
with open("./"+filename+".log",'w') as ofile:
library(httr)
library(rvest)
library(XML)
library(testit)
library(magrittr)
# origin="TPE"
# destination="SEA"
getAirlineCode <- function(origin="TPE", destination="SEA") {
library(quantstrat)
library(magrittr)
Xt = getSymbols('2498.TW', auto.assign = F)
# 1st Step: Attach MA indicators onto symbol
Xt$MA5 = Xt %>% Cl %>% SMA(5)
Xt$MA60 = Xt %>% Cl %>% SMA(60)