Skip to content

Instantly share code, notes, and snippets.

Neeraj Kashyap nkashy1

View GitHub Profile
@nkashy1
nkashy1 / alternative.bash
Created Apr 11, 2020
Alternative management for Java
View alternative.bash
#!/usr/bin/env bash
# Inspired by:
# https://stackoverflow.com/a/53902806/4905625
set -e
usage () {
echo "Usage: $0 {register|install} JAVA_DIR [PRIORITY]"
echo
@nkashy1
nkashy1 / rise-of-github-samples.jsonl
Created Mar 2, 2020
Rise of GitHub - metadata for sample repositories
View rise-of-github-samples.jsonl
This file has been truncated, but you can view the full file.
@nkashy1
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 \
View SimioticsRESTClientUsage.py
# 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
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.
@nkashy1
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
STANFORD_DOG_IMAGES_DIR=${STANFORD_DOG_IMAGES_DIR:-~/data/stanford-dogs/Images}
DOG_DIRS=$(ls -1 $STANFORD_DOG_IMAGES_DIR)
BATCH_SIZE=${BATCH_SIZE:-100}
PARALLELISM=${PARALLELISM:-0}
SIMIOTICS_SOURCE=${SIMIOTICS_SOURCE}
if [ -z "$SIMIOTICS_SOURCE" ]; then
@nkashy1
nkashy1 / lint.sh
Last active Aug 26, 2019
Pylint wrapper with scripting-friendly exit codes
View lint.sh
#!/usr/bin/env sh
# Wraps Pylint invocation to produce shell-friendly exit codes
# Because Pylint exit codes are weird:
# https://docs.pylint.org/en/1.6.0/run.html#exit-codes
PYTHON_EXECUTABLE=python
if [ ! -z $PYTHON_ENV ]; then
PYTHON_EXECUTABLE="$PYTHON_ENV/bin/python"
fi
@nkashy1
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;
@nkashy1
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');
}
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.
You can’t perform that action at this time.