Skip to content

Instantly share code, notes, and snippets.

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 < ?;
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)
@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>
@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 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: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}