Skip to content

Instantly share code, notes, and snippets.

View rep-movsd's full-sized avatar

Vivek rep-movsd

View GitHub Profile
@rep-movsd
rep-movsd / dweet_template.html
Created July 23, 2019 14:57
Dweet test template
<html>
<head>
<style>
* {
padding:0;
margin:0;
border:0;
outline:0;
overflow:hidden
}
@rep-movsd
rep-movsd / dweet.js
Created July 23, 2019 14:17
Dweet 0 : Intro
/*
u(t) is called 60 times per second.
t: elapsed time in seconds.
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
S: Math.sin
C: Math.cos
T: Math.tan
R: Generates rgba-strings, ex.: R(255, 255, 255, 0.5)
*/
@rep-movsd
rep-movsd / counter.py
Created June 30, 2018 19:06
NAND gate counter for nand2tetris HDL files
#!/bin/python2
import sys
dctNANDCount = {'Nand' : 1, 'DFF': 4, 'Screen': 0}
dctSubChipCount = {}
nChipTotal = 0
# Get the NANDs in a chip
// Always include C headers before C++ headers
#include <cctype>
#include <iostream>
#include <string>
// Use this with caution
using namespace std;
string compress(const string& sIn)
// Always include C headers before C++ headers
#include <cctype>
#include <iostream>
#include <string>
// Use this with caution
using namespace std;
string compress(const string& sIn)
@rep-movsd
rep-movsd / ChessCover.cpp
Last active May 17, 2016 21:40
Topcoder Inv 2001 Semi A+B 1000 pointer
#include <bits/stdc++.h>
#define mp make_pair
#define vstr vector<string>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define P(X) cout << X << "\t"
@rep-movsd
rep-movsd / Tothello_small.cpp
Last active May 17, 2016 20:56
Topcoder Inv 2001 Semi A+B 500 pointer (brief version)
#include <bits/stdc++.h>
#define mp make_pair
#define vstr vector<string>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define P(X) cout << X << "\t"
#define NL cout << endl
#define FOR(I,N) for(int I = 0; I < N; ++I)
@rep-movsd
rep-movsd / Iter2d.cpp
Created May 17, 2016 20:09
Basic 2D iterator
#include <bits/stdc++.h>
#define mp make_pair
#define vstr vector<string>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define P(X) cout << X << "\t"
@rep-movsd
rep-movsd / Tothello.cpp
Created May 17, 2016 19:32
Topcoder Inv 2001 Semi A+B 500 pointer
#include <bits/stdc++.h>
#define mp make_pair
#define vstr vector<string>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define P(X) cout << X << "\t"
#define NL cout << endl
@rep-movsd
rep-movsd / RuleEngine.cpp
Last active May 16, 2016 22:22
RuleEngine (CC 2002 REG Semi 1000 pointer)
#include <bits/stdc++.h>
#define vint vector<int>
#define vstr vector<string>
#define eb emplace_back
#define st string
#define cstref const string&
#define sz(x) int(x.size())