Skip to content

Instantly share code, notes, and snippets.

View BinRoot's full-sized avatar

Nishant Shukla BinRoot

View GitHub Profile
@BinRoot
BinRoot / test.c
Created February 12, 2014 18:29
app_fill esp.aplx all 1-16 16
/*
* This simulation demos using the routing table to send packets between chips.
* The NW, SE, and SW chips are all sending a packet to every core on the NE chip.
* On receiving a packet, the core simply prints an acknowledgement.
*/
#include "spin1_api.h"
#define NORTH 3
#define SOUTH 2
var person = prompt("Your name?");
if ( person!=null ) {
x = "Hi " + person + "!";
alert( x );
}
<html>
<body>
<script>
var person = prompt("What's your name?","Grace Hopper");
if ( person!=null ) {
x = "Hi " + person + "!";
alert( x );
}
</script>
<html>
<body>
<script>
var str = "the quick brown fox"
var french = str.replace("the", "le")
alert(french)
</script>
</body>
<html>
<body>
<script>
var d = new Date()
var date = d.getDate()
if ( date > 20 ) {
alert("the month is almost over")
}
import System.Random (getStdGen, randomR)
import Data.MultiSet (fromList, toOccurList)
import Data.List (maximum)
import Data.Function (on)
import Data.List (sortBy)
import Graphics.Google.Chart
import Hledger.Cli.Utils (openBrowserOn)
step xs g = (newItem : xs, newG)
where (i, newG) = pick (length xs) g
@BinRoot
BinRoot / emptiness.quote
Created September 3, 2014 06:24
Emptiness
Knowing that mentality,
taking straightforwardness as basic,
taking the real mind as the Way,
practicing martial arts in the broadest sense,
thinking correctly, clearly, and comprehensively,
taking emptiness as the Way,
you see the Way as emptiness.
In emptiness there is good but no evil.
Wisdom exists, logic exists, the Way exists, mind is empty.
@BinRoot
BinRoot / rpi.py
Created September 23, 2014 15:51
Interacting with Raspberry Pi and Thinpot potentiometer
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
DEBUG = 1
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
boolean doAction = false;
if (condition) {
doAction = true;
} else {
doAction = false;
}
if (doAction) {
// ...
// Declare your template and image
Mat* templ = ...;
Mat* img = new Mat(iplImg, true);
/// Source image to display
Mat img_display;
img -> copyTo( img_display );
/// Create the result matrix
int result_cols = img -> cols - templ -> cols + 1;