Skip to content

Instantly share code, notes, and snippets.

View chichunchen's full-sized avatar

Chi-Chun, Chen chichunchen

  • HPE/Cray
  • Minnesota
View GitHub Profile
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH
@chichunchen
chichunchen / .gitignore
Created November 26, 2014 16:51
Git ignore binary files
# Ignore all
*
# Unignore all with extensions
!*.*
# Unignore all dirs
!*/
### Above combination will ignore all files without extension ###
@chichunchen
chichunchen / Makefile
Created December 1, 2014 20:44
Compiling opencv in c++
g++ m.cpp -o app `pkg-config --cflags --libs opencv`
@chichunchen
chichunchen / Makefile
Last active August 29, 2015 14:10
OpenGL
g++ <your_file.c> -framework GLUT -framework OpenGL
@chichunchen
chichunchen / project2.cpp
Last active August 29, 2015 14:10
OS project2
#include <iostream>
#include <fstream>
#include <pthread.h>
using namespace std;
//----------------------------------------------------
/* Initialization */
//----------------------------------------------------
string filename[4]={"testdata1.txt",
@chichunchen
chichunchen / compile
Created December 9, 2014 15:44
OpenCL
Re: How to compile OpenCL example in GCC?
Precisely, the kernel compilation in OpenCL is make in running time (library call).
In Gcc, for compilation, you only need the headers (aviables on Kronos site). But for linkage, you have to install OpenCL compatible driver.
in the Makefile :
for Mac OSX : -framework OpenCL
for Linux : -lOpenCL
@chichunchen
chichunchen / README
Created December 13, 2014 21:10
Android Screen Monitor
Download Link:
http://www.adakoda.com/adakoda/android/asm/
termainl:
brew install android-sdk
android update sdk --no-ui --filter 'platform-tools'
java -jar asm.jar
@chichunchen
chichunchen / js
Created January 2, 2015 14:03
javascript interpreter
There is a Javascript interpreter in the JavaScriptCore framework that comes with OS X. The interpreter is called jsc and can be found at the following path:
/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc
There is a built-in function, quit(), which will exit interactive mode.
If you want to make it easier to use I suggest creating a symlink to a location in your path, e.g.:
sudo ln -s /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc /usr/bin
@chichunchen
chichunchen / course.rb
Last active August 29, 2015 14:13
Create可以成功新增,但是Update的時候跑出uninitialized constant CourseData的錯誤
class Course < ActiveRecord::Base
mount_uploader :CourseData, CourseDataUploader
validates :year, :name, :teacher, :grade, :category, :grade_id, :semester_id, :presence => true
validates :CourseData, :presence => true
belongs_to :grade
belongs_to :semester
@chichunchen
chichunchen / wget 中文亂碼
Created January 26, 2015 18:40
用 wget 从服务器下载文件经常遇到中文文件名变成乱码的问题。
reference: http://m13253.blogspot.tw/2013/04/solve-corrupted-chinese-filename-for-wget.html
其实不必要像那样修改源代码,wget 的 man 页面里就有解决方法。
正解是参数 --restrict-file-names=nocontrol
Update: +筱百合 提供了他的 ~/.wgetrc 文件,方便大家借鉴:
# 不要乱转义中文
--restrict-file-names=nocontrol
# 使用重定向后的文件名
--trust-server-names=on