Skip to content

Instantly share code, notes, and snippets.

View anandology's full-sized avatar

Anand Chitipothu anandology

View GitHub Profile
@anandology
anandology / rdash.py
Created June 22, 2017 06:21
POC implementation of reactive expressions for Dash
"""Reactive expressions for Dash!
Dash[1] is an interesting project build reactive web applications in Python.
While the ideas are exciting, the syntax for specifying custom code is way
too complicated that it should be.
Here is a sample code to display sum of two input values.
@app.callback(
[Input(component_id='x', component_property='value')]
@anandology
anandology / top-features.py
Created March 15, 2017 05:04
Script to find most common features found from multiple runs of an algorithm with different parameters.
"""Script to find most common features found from
multiple runs of an algorithm with different parameters.
"""
from collections import Counter
runs = [
["a", "b", "c", "d", "e"],
["a", "b", "c", "d", "f"],
["a", "b", "c", "e", "g"],
["a", "b", "d", "f", "h"]
@anandology
anandology / python-engineer.md
Last active August 31, 2018 06:11
We are looking for an experienced python engineer to join our team at Rorodata.

We are looking for an experienced python engineer to join our team at Rorodata, a data analytics startup based in Hyderabad. Interesting work in the intersection of data science, infrastructure and microservices.

This is a full-time position based out of Hyderabad. We can explore remote working only in exceptional cases.

Please ping us on rorodata.team@gmail.com if this sounds interesting to you.

About Rorodata

@anandology
anandology / boxoffice.html
Created September 2, 2016 05:25
Box Office widget snippet
<div id="boxoffice-widget" style="padding-top: 0px;"><script src="https://checkout.razorpay.com/v1/checkout.js"></script> <div class="payment-progress-wrapper payment-stages-bg" id="payment-stages"><ul class="progress-indicator"><li class="indicator active "><span class="bubble"></span>Select Tickets<br></li><li class="indicator "><span class="bubble"></span>Payment<br></li><li class="indicator "><span class="bubble"></span>Confirm<br></li></ul></div> <div class="payment-stages-wrapper"><div id="boxoffice-selectItems" class="boxoffice-section ticket-selection-content clearfix"><div id="workshop"><div><h1 class="category-heading">Workshop</h1></div> <div><div class="ticket-booking clearfix " id="python-generators-inside-out"><div class="ticket-details"><p class="ticket-title">Python Generators Inside Out</p> <div class="ticket-description"><p><i class="fa fa-calendar"></i>18 September 2016</p><p><i class="fa fa-map-marker ticket-venue"></i>TERI, Domlur, Bangalore</p><p><i class="fa fa-info" aria-hidden="tru
@anandology
anandology / mtr.txt
Created August 1, 2016 06:27
Output of traceroute and mtr from digital ocean bangalore datacenter to apt.dockerproject.org
root@docker-blr:~# mtr -w --report apt.dockerproject.org
Start: Mon Aug 1 02:22:19 2016
HOST: docker-blr Loss% Snt Last Avg Best Wrst StDev
1.|-- 139.59.16.253 0.0% 10 2.1 2.3 1.8 2.8 0.0
2.|-- 138.197.249.14 0.0% 10 0.3 0.3 0.2 0.3 0.0
3.|-- 124.124.67.154 0.0% 10 2.0 7.1 1.6 53.7 16.4
4.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
5.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
6.|-- 220.227.64.209 0.0% 10 12.1 13.0 12.0 21.2 2.8
7.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
@anandology
anandology / wget-log.txt
Created July 28, 2016 18:42
Is Digital Ocean diverting all the traffic in the droplets via a caching proxy?
I've noticed that on digital ocean droplets, the second download is way faster than the first one. Does it mean digital ocean diverting all the traffic in the droplets via a caching proxy?
******
anand@docker0:/tmp$ wget https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.10.0-0~jessie_amd64.deb
--2016-07-28 14:35:51-- https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.10.0-0~jessie_amd64.deb
Resolving apt.dockerproject.org (apt.dockerproject.org)... 54.192.151.51
Connecting to apt.dockerproject.org (apt.dockerproject.org)|54.192.151.51|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8552538 (8.2M) [application/vnd.debian.binary-package]
@anandology
anandology / search-sum.rb
Created July 3, 2016 15:49
Given an array and a number , how do I find that sum of any consecutive array elements equals the number?
def search(array, sum, expected, head, tail)
if head > tail
return false
elsif sum == expected
return [head, tail]
else
return (search(array, sum - array[head], expected, head+1, tail) or search(array, sum - array[tail], expected, head, tail-1))
end
end
@anandology
anandology / unibug.py
Last active June 24, 2016 18:08
Code reproduce a web.py bug caused with Python 3
"""Program to reproduce a bug that appears when used with Python 3.
How to reproduce:
1. Run the dev server
$ python unibug.py
http://0.0.0.0:8080/
2. Open the following URL in your browser.
@anandology
anandology / plot_decision_boundaries.py
Created March 18, 2016 22:25
Function to plot the decision boundaries of a scikit-learn classification model.
def plot_decision_boundaries(X, y, model_class, **model_params):
"""Function to plot the decision boundaries of a classification model.
This uses just the first two columns of the data for fitting
the model as we need to find the predicted value for every point in
scatter plot.
One possible improvement could be to use all columns fot fitting
and using the first 2 columns and median of all other columns
for predicting.
@anandology
anandology / Makefile
Created November 13, 2015 05:42
Makefile to export jupyterhub notebooks for all users to html
#
# Makefile to export ipython notebooks in each user home to html
# The output goes to build/$USER/$FILENAME.html
#
SOURCES=$(wildcard /home/*/*.ipynb)
TARGETS=$(shell echo $(SOURCES) | sed -e 's/.ipynb/.html/g' -e 's,/home/,build/,g')
default: $(TARGETS)
debug: