Skip to content

Instantly share code, notes, and snippets.

@leonsas
leonsas / index.html
Created July 19, 2012 15:16
bubble chart
<html>
<head></head>
<body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
<script type="text/javascript">
var dataset = {"nodes": [{"statuses_count": 905, "name": "ThinkBlue Initiative", "friends_count": 1247, "followers_count": 120, "id": 171099799, "screen_name": "ThinkBlueInit"}, {"statuses_count": 218, "name": "Be Liquid", "friends_count": 261, "followers_count": 61, "id": 293498084, "screen_name": "MyWayToDelphi"}, {"statuses_count": 284, "name": "discover5oceans", "friends_count": 1952, "followers_count": 1075, "id": 105296106, "screen_name": "discover5oceans"}]};
var w = 1000;
var h = 1000;
var center = {x: w / 2, y: h / 2}
@leonsas
leonsas / index.html
Created July 19, 2012 15:20
bubble chart
<html>
<head></head>
<body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
<script type="text/javascript">
var dataset = {"nodes": [{"statuses_count": 905, "name": "ThinkBlue Initiative", "friends_count": 1247, "followers_count": 120, "id": 171099799, "screen_name": "ThinkBlueInit"}, {"statuses_count": 218, "name": "Be Liquid", "friends_count": 261, "followers_count": 61, "id": 293498084, "screen_name": "MyWayToDelphi"}, {"statuses_count": 284, "name": "discover5oceans", "friends_count": 1952, "followers_count": 1075, "id": 105296106, "screen_name": "discover5oceans"}]};
var w = 500;
var h = 500;
var center = {x: w / 2, y: h / 2}
@leonsas
leonsas / index.html
Created July 19, 2012 15:51
collision from dset
<html>
<head></head>
<body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
<script type="text/javascript">
var dataset = {"nodes": [{"statuses_count": 905, "name": "ThinkBlue Initiative", "friends_count": 1247, "followers_count": 120, "id": 171099799, "screen_name": "ThinkBlueInit"}, {"statuses_count": 218, "name": "Be Liquid", "friends_count": 261, "followers_count": 61, "id": 293498084, "screen_name": "MyWayToDelphi"}, {"statuses_count": 284, "name": "discover5oceans", "friends_count": 1952, "followers_count": 1075, "id": 105296106, "screen_name": "discover5oceans"}, {"statuses_count": 948, "name": "Katie Vogel", "friends_count": 1256, "followers_count": 327, "id": 18323274, "screen_name": "vogelian"}, {"statuses_count": 85, "name": "Nicole McLachlan", "friends_count": 96, "followers_count": 319, "id": 245773605, "screen_name": "pathtoprotect"}, {"statuses_count": 0, "name": "Valerio Pandolfi", "friends_count": 271, "followers_count": 43, "id": 561857821, "screen
@leonsas
leonsas / index.html
Created July 22, 2012 21:19 — forked from mbostock/.block
Bubble chart
<!DOCTYPE html>
<meta charset="utf-8">
<style>
circle {
stroke: #fff;
}
</style>
<body>
import dateutil.parser
import optparse
from Queue import Queue
import tempodb
from threading import Thread
class Worker(Thread):
"""Thread executing tasks from a given tasks queue"""
def __init__(self, tasks):
Thread.__init__(self)
SELECT *
FROM (
SELECT symbol,
timestamp,
avg(CLOSE) over (PARTITION BY symbol ORDER BY timestamp ASC ROWS BETWEEN ? preceding AND CURRENT ROW) movingavg
FROM all_stockdailys
WHERE symbol=rpad(?,16)
ORDER BY timestamp DESC)
WHERE ROWNUM < ?;
@leonsas
leonsas / gist:9c4387ff71dd0b564366
Last active August 29, 2015 14:09
Wiki to png
CITIES = [
('Chicago', 'chicago'),
('New_York_City', 'newyork'),
('Los_Angeles', 'losangeles'),
('Paris', 'paris'),
('Tokyo', 'tokyo'),
]
command_str ="""
/Users/leonsas/projects/temp/capturejs/capture.js --uri http://en.wikipedia.org/wiki/%s \
function forEachHTMLCollection(collection, fn){
for (var i = collection.length - 1; i >= 0; i--) {
fn(collection[i]);
};
}
ps = document.getElementsByTagName('p');
forEachHTMLCollection(ps, function(e){
e.style.color = 'white';
var linkranks = {"Paris": {"Rh%C3%B4ne-Alpes": 0.003025313292630801, "Women%27s_march_on_Versailles": 0.001960156560233164, "Tuileries_Palace": 0.001960156560233164, "Jacques_Chirac": 0.005880469680699492, "Metropolitan_area": 0.0002820987671835713, "Liverpool": 0.0006656336150812513, "Church_of_Saint-Sulpice,_Paris": 0.001960156560233164, "Luxembourg_in_the_Eurovision_Song_Contest": 0.0007010761311666402, "Basilica_of_St_Denis": 0.003920313120466328, "Eure": 0.0033556310996435625, "China": 0.0003702107970702168, "A86_autoroute": 0.003920313120466328, "Caen": 0.0033556310996435625, "Euro": 0.002460631271808035, "Azerbaijan_in_the_Eurovision_Song_Contest": 0.0007010761311666402, "Democratic_Republic_of_the_Congo": 0.0011675251349560507, "Paris_Match": 0.001960156560233164, "Mus%C3%A9e_d%27Art_Moderne_de_la_Ville_de_Paris": 0.001960156560233164, "List_of_films_set_in_Paris": 0.001960156560233164, "President_of_France": 0.003920313120466328, "Place_Dauphine": 0.001960156560233164, "Eurovision_Song_Contest_1967":
Verifying that +leonsas is my openname (Bitcoin username). https://onename.com/leonsas