Skip to content

Instantly share code, notes, and snippets.

View BinRoot's full-sized avatar

Nishant Shukla BinRoot

View GitHub Profile
@BinRoot
BinRoot / eyesFound.java
Created July 28, 2013 08:26
this method will return true is eyes are found, else false if blinked
public boolean eyesFound(Bitmap b) {
int width = b.getWidth();
int height = b.getHeight();
Log.d(TAG, "finding eyes... "+b.getConfig()+", "+width+"x"+height);
FaceDetector faceDetector = new FaceDetector(width, height, 1);
FaceDetector.Face[] faces = new FaceDetector.Face[1];
faceDetector.findFaces(b, faces);
FaceDetector.Face f = faces[0];
Well, came grading time and a curious fact emerged:
the works of highest quality were all produced by the group being graded for quantity.
- "Art and Fear"
Failure to act when action is needed is as much a failure as taking the wrong kind of action might be.
- Mark Shuttleworth, on defending Mir
@BinRoot
BinRoot / gist:5915231
Created July 3, 2013 03:28
Authenticate your machine w/ AWS
cat ~/.ssh/id_dsa.pub | ssh -i amazon-generated-key.pem ec2-user@amazon-instance-public-dns "cat >> .ssh/authorized_keys"
@BinRoot
BinRoot / webprivacy.quote
Last active December 18, 2015 15:09
Web Privacy
Civilization, which is held together by a fragile web of tactful phrasing,
polite omissions and white lies, would collapse in an apocalypse of
bitter recriminations and weeping, breakups and fistfights,
divorces and bankruptcies, scandals and resignations,
blood feuds, litigation, wholesale slaughter in the streets and lingering ill will.
- Tim Kreider, "I Know What You Think of Me"
@BinRoot
BinRoot / ram.quote
Created May 17, 2013 03:20
Random Access Memories
...having fun with the word 'memory', which has become a very technical, very sterile term.
And obviously, when you use the plural, which is 'memories',
it's something that is totally different.
It's something that is highly emotional.
- Daft Punk
Black, white, circle, square, wood, stone — how hard could it be?
- SF Go Club
@BinRoot
BinRoot / larrypage.quote
Last active December 17, 2015 09:48
Beta Country
I like going to Burning Man.
As a technologist maybe we need some safe places where we can try things
and not have to deploy to the entire world.
- Larry Page
private static long getNextTime(int timesPerDay) {
ExponentialRandomVariable exponentialRandomVariable = new ExponentialRandomVariable(1.0/((double)timesPerDay));
double x = exponentialRandomVariable.nextRandomVariable();
long ms = (long)(x * 86400000);
return ms;
}
@BinRoot
BinRoot / gist:5430764
Last active December 16, 2015 11:58
I'm not proud of this code. I should have use asyncjs.
app.get('/api/vote', function(req, res, next) {
ensureAuthenticated(req, res, next, '/publish');
}, function(req, res) {
var cid = req.query["cid"];
var u1id = req.user.id; // voter
// ASYNC CALL 1, HERE WE GOOOOO!!
db.findUser({id: u1id}, function(user1Obj) { // get user1 object (mongo)
var previouslyVoted = false;
var votes = user1Obj.votes;