Skip to content

Instantly share code, notes, and snippets.

@goulu
goulu / index.html
Last active June 27, 2018 10:45
Table using D3.js and clusterize.js
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>D3Table</title>
<link rel="stylesheet" href="https://rawgit.com/goulu/Clusterize.js/master/clusterize.css"></script>
<script src="https://rawgit.com/goulu/Clusterize.js/master/clusterize.js"></script>
<script src='http://d3js.org/d3.v3.js' type='text/javascript'></script>
<script src="./table.js" type='text/javascript'></script>
</head>
@goulu
goulu / itimeout.py
Last active September 14, 2015 13:30
multiplatform timeout for loops in Python
from threading import Timer
from multiprocessing import TimeoutError
def itimeout(iterable,timeout):
"""timeout for loops
:param iterable: any iterable
:param timeout: float max running time in seconds
:yield: items in iterator until timeout occurs
:raise: multiprocessing.TimeoutError if timeout occured
"""
@rupey
rupey / mandelbrot.sql
Last active December 7, 2020 05:38
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@mblondel
mblondel / einsum.py
Created May 22, 2015 05:36
Einstein sum notation
import numpy as np
rng = np.random.RandomState(0)
print "Trace"
A = rng.rand(3, 3)
print np.trace(A)
print np.einsum("ii", A)
print
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis (mike.philip.davis@gmail.com)
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import select
@jiahao
jiahao / Optimizer.py
Created January 4, 2012 17:44
Pure Python implementation of some numerical optimizers
#!/usr/bin/env python
'''
Pure Python implementation of some numerical optimizers
Created on Jan 21, 2011
@author Jiahao Chen
'''