Skip to content

Instantly share code, notes, and snippets.

@ccwang002
ccwang002 / log
Last active August 29, 2015 13:56
R 3.0.2 Performance Test on OSX 10.9.2 of Generic RBLAS and OpenBLAS (dev)
## R-benchmark-25 from http://r.research.att.com/benchmarks/R-benchmark-25.R
# brew install r [--with-openblas]
$ Rscript R-benchmark-25.R 2014-03-01 (六) 00:41 CST
Loading required package: Matrix
Loading required package: methods
Loading required package: lattice
Loading required package: SuppDists
警告訊息:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ccwang002
ccwang002 / 01_Instructions.md
Last active August 29, 2015 14:14
Using Python Tools for Visual Studio (PTVS)

環境設定

PTVS 的版本可以透過 VS 中 HELP -> About Microsoft Visual Studio 查看。Python 的版本選擇非常多,請參見 PTVS 說明。在這邊是選用 Miniconda3 (Python 3.4) 示範。

@ccwang002
ccwang002 / Transform.ipynb
Created February 11, 2015 16:03
Transform Bird Record
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
rs = np.random.RandomState(seed=5566)
n_conditions = 10
# Here we simulate a complex computation, for example, analogy of the magnitude
# of gradient decent which expects to be strictly positive. But from the result
# we find that it seems to be sometimes negative, we wish to find out when and
# what condition our program produces bogus ouput.
#
# This is the case to use pdb and condition break point
@ccwang002
ccwang002 / tz_convert.py
Last active August 29, 2015 14:18
Timezone Conversion
from datetime import datetime
from pytz import timezone # pip install pytz
# Setup remote time
remote_tz = timezone('US/Pacific') # PST for example
remote_dt = remote_tz.localize(datetime(2015, 5, 1, 14, 0)) # May 1, 2015 PM2:00 PST
# Setup Taipei local time
tpe = timezone('Asia/Taipei')
$ export CC=clang
$ export CXX=clang
$ export FFLAGS=-ff2c
$ git clone https://github.com/numpy/numpy.git
$ cd numpy
$ python3 setup.py build
$ python3 setup.py install
@ccwang002
ccwang002 / python indentation case
Created December 13, 2012 14:40
sample case to show that sometimes it is tricky to determine the indentation of python code automatically.
if a==b:
with open('f.txt') as f:
# do something
# do something