Skip to content

Instantly share code, notes, and snippets.

View sughodke's full-sized avatar

Sid Ghodke sughodke

  • San Jose, California
View GitHub Profile
#!/bin/python
def myFun(ar, cols=3):
le = len(ar)
rem = le % cols
binSize = cols - rem
line = 0
i = 0
@sughodke
sughodke / index.html
Last active August 29, 2015 13:57
Olympic Medals By Country By Year (Freebase)
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
@sughodke
sughodke / index.html
Last active August 29, 2015 14:00
Heatmap of Train Data
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
@sughodke
sughodke / README.md
Last active April 19, 2020 20:15
Timeline of Engineering and Technology History

Using the data from IEEE ethw website to show a timeline of achievements.

@sughodke
sughodke / question_clf.py
Created December 14, 2016 22:47
Determine if some text is a question
import nltk
import random
from pprint import pprint
from sklearn.pipeline import Pipeline
from sklearn.metrics import classification_report
from sklearn.feature_extraction.text import HashingVectorizer
posts = nltk.corpus.nps_chat.xml_posts([
@sughodke
sughodke / ulam.py
Created April 15, 2017 07:59
Output the value of the Ulam spiral
import numpy as np
def ulam_polar(x, y, verbose=False):
"""
Solves for the value at location (x, y) in the Ulam spiral by
(1) converting to (x, y) polar coordinates (r, theta)
(2) developing a `Ulam square` for a given ring-size
(3) finding the intersection of the the Ulam square and the input vector
11/21/16 Hourly Breakdown of Renewable Resources (MW)
Hour GEOTHERMAL BIOMASS BIOGAS SMALL HYDRO WIND TOTAL SOLAR PV SOLAR THERMAL
1 962 218 180 254 384 0 0
2 962 215 180 217 479 0 0
3 962 215 181 208 430 0 0
4 958 214 180 229 969 0 0
5 956 218 179 288 1272 0 0
6 956 220 180 290 1395 0 0
7 956 227 181 294 1336 55 0
8 955 238 178 310 1616 1682 0
@sughodke
sughodke / watcher.py
Created September 24, 2017 19:17
ActivityWatch plugin for osquery
#!/usr/bin/env python
import osquery
import requests
headers = {
'Accept': 'application/json',
}
URL = 'http://localhost:5600/api/0/' \
'buckets/aw-watcher-window_Beaker-2.local/events'
@sughodke
sughodke / knapsack.py
Last active January 3, 2018 00:46
Production Ready Knapsack
# SG: Modified to produce Markdown output
#
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed in the hope that it will be useful,
@sughodke
sughodke / README.md
Last active January 5, 2018 22:26 — forked from mbostock/README.md
Ulam Spiral Quadtree 1

Ulam Archamedial Spiral

Ulam Spiral is a way of visualising prime numbers. We start with 1 in center and continue writing numbers in a rectangular spiral. Above, numbers in yellow are prime numbers. The spiral can be thought to demonstrate prime numbers form patterns.

Ulam Spiral Wikipedia page

Numberphile Youtube video

Adapted from Mike's Quadtree demo