Skip to content

Instantly share code, notes, and snippets.

Avatar

Viraj Sinha vsinha

View GitHub Profile
@vsinha
vsinha / main.cpp
Created Sep 23, 2016
esp8266 arduino wifi
View main.cpp
#include <ESP8266WiFi.h>
const char* ssid = "************";
const char* password = "****************";
WiFiServer server(80);
void setup()
{
Serial.begin(115200);
View findStraight.py
def searchForStraight(self, cards, length):
expected = cards[0].rank # initialize to first card
counter = 0 # keep track of length of# the current straight
for card in cards:
#print('rank: ', card.rank, ', expect: ', expected)
if card.rank == expected: # we are inside a "straight",
# potentially of length 1
counter += 1
elif card.rank == expected-1: # if this is another of the card we just saw
View gist:babfaf571924b4ae5ac9
### Keybase proof
I hereby claim:
* I am vsinha on github.
* I am vsinha (https://keybase.io/vsinha) on keybase.
* I have a public key whose fingerprint is 1F74 0BBE 8863 B0AA 1742 BBA5 3D92 77B3 53E7 8BE6
To claim this, I am signing this object:
@vsinha
vsinha / plot.html
Created Aug 8, 2014
dygraphs plot tool for stock data (stored as csvs in data/ folder relative to wherever this file is). Run "python -m SimpleHTTPServer" in the folder this file is in
View plot.html
<html>
<head>
<script type="text/javascript" src="dygraph-combined.js"></script>
<style>
body{
font-family:"Helvetica";
}
.graph {
height: 250px;
View max_in_dict.py
import operator
# create a dict
d = dict()
d[0] = 10
d[1] = 20
d[2] = 20
# find the max value
maxValue = max(d)
You can’t perform that action at this time.