Skip to content

Instantly share code, notes, and snippets.

View shurane's full-sized avatar

Ehtesh Choudhury shurane

  • Astoria, NY | Seattle, WA
  • 08:17 (UTC -07:00)
View GitHub Profile
function numToBinaryString(num, padding=8) {
const n = num.toString(2);
const paddedString = "0".repeat(padding);
return paddedString.substr(n.length) + n;
}
for (let i = 0; i < 20; i++){
console.log(i, numToBinaryString(i));
}
@shurane
shurane / .gitignore
Last active April 5, 2019 19:00
2019.04.04.pinterest.api
*.log
package-lock.json
node_modules/
secrets.js
@shurane
shurane / ElasticSearchRequests.cs
Created April 8, 2018 02:01
Working with a dataset with ElasticSearch and C#
using System;
using System.Net.Http;
using System.Web;
namespace ElasticSearchRequests
{
class Program
{
static void Main(string[] args)
{
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return "TreeNode({})".format(self.val)
# see https://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1/ for tips
import React, { Component } from 'react';
import { debounce } from 'lodash';
class SearchBox extends Component {
constructor(props) {
super(props);
this.state = {value: ''};
// https://stackoverflow.com/a/28046731/198348
// this.handleChange = this.handleChange.bind(this);
@shurane
shurane / App.config
Created April 25, 2017 17:28
Logging.csproj
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<remove name="Default" />
<add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener"/>
</listeners>
</trace>
</system.diagnostics>
@shurane
shurane / config.cson
Last active January 13, 2017 22:55
Atom Editor Configs
"*":
core:
disabledPackages: [
"spell-check"
]
telemetryConsent: "limited"
editor:
fontSize: 16
invisibles: {}
lineHeight: 1.2
import random
# import blessings
# term = blessings.Terminal()
# this looks suspiciously a lot like the fisher yates algorithm
lst = range(30)
# def colorized(lst, yellows=[]):
# result = "["