This file contains hidden or 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 <iostream> | |
| #include <pthread.h> | |
| using namespace std; | |
| class ScopedLock { | |
| public: | |
| ScopedLock(pthread_mutex_t & m): mp(&m){ | |
| pthread_mutex_lock(mp); | |
| }; | |
| ~ScopedLock(){ |
This file contains hidden or 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
| Use folowing steps to repackage dep package: | |
| 1: Extract deb package | |
| # dpkg-deb -x <package.deb> <dir> | |
| 2: Extract control-information from a package | |
| # dpkg-deb -e <package.deb> <dir/DEBIAN> | |
| 3. After completed to make changes to the package, repack the deb | |
| # dpkg-deb -b <dir> <new-package.deb> |
This file contains hidden or 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
| #!/usr/bin/ruby | |
| # Create display override file to force Mac OS X to use RGB mode for Display | |
| # see http://embdev.net/topic/284710 | |
| require 'base64' | |
| data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
| edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
| vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
This file contains hidden or 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
| CC=g++ | |
| MOC=moc-qt4 | |
| CFLAGS=-Wall | |
| SOURCES=hello.cc hello_cls.cc | |
| MOC_HEADERS=hello_cls.h | |
| EXECUTABLE=hello | |
| INCDIRS=-I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore | |
| LIBS=-lQtCore -lQtGui | |
| # Change postfixes | |
| MOC_SOURCES=$(MOC_HEADERS:.h=.moc.cc) |
This file contains hidden or 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
| #!/usr/bin/env python | |
| from PySide.QtCore import * | |
| from PySide.QtGui import * | |
| import cv2 | |
| import sys | |
| class MainApp(QWidget): | |
| def __init__(self): |
This file contains hidden or 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 <dirent.h> | |
| #include <iterator> | |
| #include <cstdlib> | |
| #include <cstring> | |
| #include <sstream> | |
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <string> | |
| #include <sys/stat.h> | |
| #include <syslog.h> |
This file contains hidden or 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
| /* | |
| ** Binary Search Tree implementation in C++ | |
| ** Harish R | |
| */ | |
| #include<iostream> | |
| using namespace std; | |
| class BST { | |
| struct node { |
This file contains hidden or 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
| echo "Fixing ownership and permissions..." | |
| chmod -R 755 /System/Library/Extensions/* | |
| chown -R root:wheel /System/Library/Extensions/* | |
| chown root:admin / | |
| echo "Rebuilding kext cache..." | |
| kextcache -system-prelinked-kernel | |
| kextcache -system-caches |
This file contains hidden or 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
| // from http://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100 | |
| function foo(l, target) { | |
| var off = target - _.reduce(l, function(acc, x) { return acc + Math.round(x) }, 0); | |
| return _.chain(l). | |
| sortBy(function(x) { return Math.round(x) - x }). | |
| map(function(x, i) { return Math.round(x) + (off > i) - (i >= (l.length + off)) }). | |
| value(); | |
| } |
This file contains hidden or 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
| #!/bin/sh -x ## or just ` curl -Ls http://git.io/vRozn | sh `. | |
| ## Downloads the Mac OS X 10.10 Recovery Partition update, | |
| ## Copy's over the 10.10 version of Disk Utility.app, then | |
| ## use git to apply a binary patch so it will run on 10.11+. | |
| cd /tmp | |
| rm -rf DU1010 | |
| mkdir DU1010 |
OlderNewer