This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filename = 'irregular.bmp'; | |
RGB = imread(filename); | |
grayscale = rgb2gray(RGB); | |
numTotalPixel = size(grayscale,1) * size(grayscale, 2); | |
numBlackPixel = sum(grayscale(:)==0); | |
numWhitePixel = sum(grayscale(:)==255); | |
percentBlackPixel = numBlackPixel / numTotalPixel * 100; | |
percentWhitePixel = numWhitePixel / numTotalPixel * 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I = checkerboard(400,4,6) > 0.5; | |
imwrite(I, 'check.png'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 120 | |
uniform sampler2D uSampler; | |
varying vec2 vUv; | |
void main() | |
{ | |
// if ( !gl_FrontFacing ) { | |
// discard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Modify -> Center Pivot. Make world pivots go to the center of the mesh. | |
- Modify -> Freeze Transformations. Reset translation and rotation axes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linux / Mac | |
$ lipo -info filename.a | |
$ file filename.a | |
# Windows | |
$ dumpbin /rawdata:1 library.lib | |
$ dumpbin /headers program.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <atomic> | |
#include <conio.h> | |
#include <chrono> | |
#include <iostream> | |
#include <thread> | |
#include <vector> | |
using namespace std; | |
atomic<int> data(0); |