Skip to content

Instantly share code, notes, and snippets.

View anandology's full-sized avatar

Anand Chitipothu anandology

View GitHub Profile
@anandology
anandology / seeds_view.py
Created November 10, 2010 04:49
Python Script to add design document to couchdb database
import couchdb
view = {
"_id": "_design/seeds",
"fulltext": {
"by_seed": {
"index": """function(doc) {
if (doc.seeds) {
var d = new Document();
for (var i=0; i<doc.seeds.length; i++) {
@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 / gist:3929961
Created October 22, 2012 06:24
BSNL DNS servers are crappy
# BSNL
# Primary DNS Server: 218.248.245.1
# Secondary DNS Server: 218.248.255.141
#
# In this case the secondary DNS server looks unhealthy.
# Taking too long to respond or failing to respond.
$ time dig @218.248.255.141 archive.org
; <<>> DiG 9.6-ESV-R4-P3 <<>> @218.248.255.141 archive.org
@anandology
anandology / day1.ipynb
Last active January 4, 2016 18:59
Notes from python training at LinkedIn (Jan 28-Jan30, 2014) - http://nbviewer.ipython.org/gist/anandology/8663909/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anandology
anandology / day1.ipynb
Last active December 31, 2015 05:09
Advanced Python TrainingDecember 13-14, 2013Global Analytics -- http://nbviewer.ipython.org/gist/anandology/7939444
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anandology
anandology / Readme.txt
Last active December 28, 2015 06:59
Advanced Python Workshop - Nov 2013 http://advancedpython.hasgeek.com/
Notes from Advanced Python Workshop by Anand Chitipothu conducted on Nov 14-16, 2013
@anandology
anandology / day1.ipynb
Last active December 23, 2015 23:39
Python Training - September 26-28, 2013
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.