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
@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 / 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 / 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 / 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 / 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 / Makefile
Last active August 29, 2015 14:10
OpenGL
g++ <your_file.c> -framework GLUT -framework OpenGL
@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 / .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 ###
### 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 / dyc_arr.cpp
Created November 4, 2014 08:41
C++ dynamic allocate
int* a = NULL; // Pointer to int, initialize to nothing.
int n; // Size needed for array
cin >> n; // Read in the size
a = new int[n]; // Allocate n ints and save ptr in a.
for (int i=0; i<n; i++) {
a[i] = 0; // Initialize all elements to zero.
}
. . . // Use a as a normal array
delete [] a; // When done, free memory pointed to by a.
a = NULL; // Clear a to prevent using invalid memory reference.