Skip to content

Instantly share code, notes, and snippets.

View ankitshekhawat's full-sized avatar

Ankit Shekhawat ankitshekhawat

  • Bangalore, India
View GitHub Profile
@ankitshekhawat
ankitshekhawat / moonraider.js
Last active December 11, 2017 17:56
Change gmail logo user script
// ==UserScript==
// @name Moonraider
// @namespace http://moonraft.com/
// @version 0.2
// @description Chanege the mail logo to one you want
// @author You
// @match https://mail.google.com/mail/*
// @grant none
// ==/UserScript==
@ankitshekhawat
ankitshekhawat / wifiscanner.py
Last active February 2, 2017 09:02
A simple python wifi scanner for OSX using OSX's airport command line utility. Returns Mac Addresses and RSSI
from subprocess import check_output
import re
def scan_networks():
airport = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s'
rc = check_output(airport, shell=True).split('\n')[1:-1]
networks =[]
for i in rc:
i = i.lstrip().rstrip()
@ankitshekhawat
ankitshekhawat / product.js
Created January 13, 2017 16:41 — forked from cybercase/product.js
Python-like itertools.product function in javascript
function product() {
var args = Array.prototype.slice.call(arguments); // makes array from arguments
return args.reduce(function tl (accumulator, value) {
var tmp = [];
accumulator.forEach(function (a0) {
value.forEach(function (a1) {
tmp.push(a0.concat(a1));
});
});
return tmp;
@ankitshekhawat
ankitshekhawat / export_tf_models.py
Created January 10, 2017 05:50
Export models and weights are trained in Keras to be used in TensorFlow Serving library
from keras import backend as K
import tensorflow as tf
from tensorflow.contrib.session_bundle import exporter
sess = K.get_session()
export_path ="."
export_version = 1
saver = tf.train.Saver(sharded=True)
### Code if you want to only export .meta files
@ankitshekhawat
ankitshekhawat / swatching.py
Last active January 9, 2023 19:59
A quick python code to detect color of an item from ecommerce website using just kmeans without OpenCV. Nowhere close to accurate but good for a quick hack. Can be improved with Sobel edge detection and skin detection.
import numpy as np
from PIL import Image, ImageDraw
import colorsys, random
from pylab import plot,show
from numpy import vstack,array
from numpy.random import rand
from scipy.cluster.vq import kmeans,vq
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.image as mpimg