Skip to content

Instantly share code, notes, and snippets.

hezhao

Block or report user

Report or block hezhao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sleepdemoserial.c
/* Sleep Demo Serial
* -----------------
* Example code to demonstrate the sleep functions in a Arduino. Arduino will wake up
* when new data is received in the serial port USART
* Based on Sleep Demo Serial from http://www.arduino.cc/playground/Learning/ArduinoSleepCode
*
* Copyright (C) 2006 MacSimski 2006-12-30
* Copyright (C) 2007 D. Cuartielles 2007-07-08 - Mexico DF
*
* With modifications from Ruben Laguna 2008-10-15
@hezhao
hezhao / checkerboard7x11
Created Jun 25, 2014
Print a checkerboard of 7x11 inner corners with 400px square
View checkerboard7x11
I = checkerboard(400,4,6) > 0.5;
imwrite(I, 'check.png');
View texture.fs.glsl
#version 120
uniform sampler2D uSampler;
varying vec2 vUv;
void main()
{
// if ( !gl_FrontFacing ) {
// discard;
@hezhao
hezhao / qt4xcode.sh
Last active Aug 29, 2015
Create and deploy Xcode project from Qt 4 .pro file
View qt4xcode.sh
## http://dragly.org/2012/01/13/deploy-qt-applications-for-mac-os-x/
## http://bleepsandpops.com/post/8447919182/adding-the-fmod-api-to-an-xcode-4-project
$ qmake -spec macx-xcode yourprojectname.pro
$ macdeployqt yourappname.app -dmg
## $ otool -L yourappname.app/Contents/MacOS/yourappname
## $ install_name_tool -change /app_dir/lib.dylib @executable_path/../Frameworks/Versions/lib.dylib yourappname
View maya_shortcuts
- Modify -> Center Pivot. Make world pivots go to the center of the mesh.
- Modify -> Freeze Transformations. Reset translation and rotation axes.
@hezhao
hezhao / arch.sh
Last active Aug 29, 2015
Check the architectures of a library
View arch.sh
# Linux / Mac
$ lipo -info filename.a
$ file filename.a
# Windows
$ dumpbin /rawdata:1 library.lib
$ dumpbin /headers program.exe
@hezhao
hezhao / opencv_cmake.sh
Last active Aug 29, 2015
Build OpenCV static libraries from source using cmake
View opencv_cmake.sh
# build static libraries for both i386 and x86_64 arch
$ mkdir build
$ cd build
$ cmake -DBUILD_SHARED_LIBS=OFF "-DCMAKE_OSX_ARCHITECTURES=i386;x86_64" ..
$ make -j8
@hezhao
hezhao / advanced_copy.sh
Last active Aug 29, 2015
Copy every nth file and show progress bar
View advanced_copy.sh
# http://www.tecmint.com/advanced-copy-command-shows-progress-bar-while-copying-files/
#
$ wget https://dl.dropboxusercontent.com/u/6233134/cp
$ sudo chmod +x cp
$ ./cp -gR src/*[13579].jpg dest/
@hezhao
hezhao / multithreading.cpp
Created May 26, 2015
Example of shared data with multiple threads in C++
View multithreading.cpp
#include <atomic>
#include <conio.h>
#include <chrono>
#include <iostream>
#include <thread>
#include <vector>
using namespace std;
atomic<int> data(0);
@hezhao
hezhao / quickselect.cpp
Created May 29, 2015
Find the kth smallest element in an unordered list.
View quickselect.cpp
//
// http://en.wikipedia.org/wiki/Quickselect
// Quickselect
//
// Find the kth smallest element in an unordered list
//
#include <iostream>
using namespace std;
You can’t perform that action at this time.