Skip to content

Instantly share code, notes, and snippets.


Neeraj Kashyap nkashy1

View GitHub Profile
View clojure-tree-descendant-counting
(def test-tree {1 {:root nil} 2 {:root 1} 3 {:root 1} 4 {:root 2} 5 {:root 1} 6 {:root 4}})
(defn path-to-top [tree v]
(if (nil? v)
(cons v (path-to-top tree (:root (get tree v))))))
(defn steps-indexed-path
([upward-path steps]
(if (= upward-path '())
nkashy1 /
Last active Jun 19, 2017
Markdown anchors




(Scroll all the way down beyond the wall of text)

(Wall of text generated by randomtextgenerator)

Necessary ye contented newspaper zealously breakfast he prevailed. Melancholy middletons yet understood decisively boy law she. Answer him easily are its barton little. Oh no though mother be things simple itself. Dashwood horrible he strictly on as. Home fine in so am good body this hope.

nkashy1 / file-sms-signal.js
Last active Apr 22, 2018
Alert using SMS on file creation
View file-sms-signal.js
var path = require('path');
var {poll} = require('@nkashy1/pollster');
var {spawnPredicate} = require('@nkashy1/pollster/predicates');
var twilio = require('twilio');
// START fs config
var rawFilepath = process.env.WATCH_FILE;
if (!rawFilepath) {
throw new Error('WATCH_FILE (undefined) should be the path that you want to poll for file existence');
nkashy1 / gce-instance-pollster.js
Created Apr 22, 2018
Poll GCE instance to make sure it hasn't died (or been pre-empted)...
View gce-instance-pollster.js
var Compute = require('@google-cloud/compute');
var {poll} = require('@nkashy1/pollster');
var twilio = require('twilio');
// START gcp-related setup
const gcpProject = process.env.GOOGLE_CLOUD_PROJECT
const gcpSacred = process.env.GOOGLE_APPLICATION_CREDENTIALS
const gceZone = process.env.GOOGLE_COMPUTE_ZONE;
const gceInstance = process.env.GOOGLE_COMPUTE_INSTANCE;
View serving-input-reception-bug.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
nkashy1 /
Last active Aug 26, 2019
Pylint wrapper with scripting-friendly exit codes
#!/usr/bin/env sh
# Wraps Pylint invocation to produce shell-friendly exit codes
# Because Pylint exit codes are weird:
if [ ! -z $PYTHON_ENV ]; then
nkashy1 / stanford-dogs.bash
Last active Sep 23, 2019
Upload Stanford Dogs dataset to S3 and register against Simiotics Data Registry
View stanford-dogs.bash
#!/usr/bin/env bash
if [ -z "$SIMIOTICS_SOURCE" ]; then
nkashy1 / simiotics_python.ipynb
Created Oct 30, 2019
Tutorial: Using Simiotics from Python
View simiotics_python.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# First, run:
# pip install simiotics
from simiotics.clients import SimioticsRESTClient
if __name__ == '__main__':
import json
import time
dataset_id = f'test-dataset-{int(time.time())}'
nkashy1 / Dockerfile
Created Dec 1, 2019
Powershell alpine docker image
View Dockerfile
FROM alpine:3.10.3
RUN apk add --no-cache \
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
You can’t perform that action at this time.