Skip to content

Instantly share code, notes, and snippets.

View lsbardel's full-sized avatar
☀️
magic

Luca Sbardella lsbardel

☀️
magic
View GitHub Profile
@lsbardel
lsbardel / listinsert.py
Created June 13, 2014 08:36
python list insert versus addition
import timeit
def make(n):
return list(range(n))
def add(v):
return ['bla'] + v
@lsbardel
lsbardel / asyncserv.py
Last active August 29, 2015 14:04
asyncio server coroutine style
import asyncio
def block_read_from_database():
result = yield from asyncio.sleep(1, b'OK')
return result
class Protocol(asyncio.Protocol):
def connection_made(self, transport):
@lsbardel
lsbardel / yield_from.py
Created July 25, 2014 12:50
yield from future and trollius in debug mode
import os
import logging
os.environ['PYTHONASYNCIODEBUG'] = 'debug'
os.environ['TROLLIUSDEBUG'] = 'debug'
import asyncio
from asyncio import Future
import trollius
@lsbardel
lsbardel / twoloops.py
Created July 25, 2014 16:50
two loops in asyncio debug mode
import os
import logging
os.environ['PYTHONASYNCIODEBUG'] = 'debug'
os.environ['TROLLIUSDEBUG'] = 'debug'
import asyncio
import trollius
asyncio.set_event_loop_policy(trollius.get_event_loop_policy())
@lsbardel
lsbardel / agile.json
Last active August 29, 2015 14:05
Json data for agile methodology visualization
{
"name": "Process",
"title": "Our agile process",
"description": "We build properly tested software in short increments with constant feedback with our clients. Each development iteration delivers a more tested and documented product.",
"children": [
{
"name": "Plan",
"icon": "fa fa-magic fa-lg",
"description": "Our planning process translates the business needs of your project into clear requirements. We listen, research and collaborate with you to deliver fully informed project requirements.",
"order": 1,
quantmind quantmind quantmind quantmind quantmind
python python python python
javascript javascript
data data data
algorithms algorithms
quantitativeFinance quantitativeFinance
R R
angularJS angularJS
d3js d3js
requireJS
@lsbardel
lsbardel / population.csv
Created May 11, 2015 10:43
World population data
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Country Name;Country Code;1960;1961;1962;1963;1964;1965;1966;1967;1968;1969;1970;1971;1972;1973;1974;1975;1976;1977;1978;1979;1980;1981;1982;1983;1984;1985;1986;1987;1988;1989;1990;1991;1992;1993;1994;1995;1996;1997;1998;1999;2000;2001;2002;2003;2004;2005;2006;2007;2008;2009;2010;2011;2012;2013;2014
Aruba;ABW;54208;55435;56226;56697;57029;57360;57712;58049;58385;58724;59065;59438;59849;60239;60525;60655;60589;60366;60106;59978;60096;60567;61344;62204;62831;63028;62644;61835;61077;61032;62148;64623;68235;72498;76700;80326;83195;85447;87276;89004;90858;92894;94995;97015;98742;100031;100830;101219;101344;101418;101597;101932;102384;102911;
Andorra;AND;13414;14376;15376;16410;17470;18551;19646;20755;21888;23061;24279;25560;26892;28231;29514;30706;31781;32769;33746;34819;36063;37502;39112;40862;42704;44597;46515;48458;50431;52449;54511;56674;58904;61003;62707;63854;64274;64090;63799;64084;65399;68000;71639;75643;79060;81223;81877;81292;79969;78659;77907;77865;78360;79218;
Afghanistan;AFG;8774440;8953544;9141783;93
Host *
ControlPersist yes
ControlMaster auto
ControlPath /tmp/ssh-%r@%h:%p
ServerAliveInterval 60
@lsbardel
lsbardel / pylink.sh
Created November 11, 2009 22:22 — forked from zvoase/pylink.sh
Link a python module to your site packages. Run dos2unix command on the file before use.
@lsbardel
lsbardel / clean.py
Created November 12, 2009 14:13
clean python binary files from a directory structure
import os
def rmgeneric(path, __func__):
try:
__func__(path)
#print 'Removed ', path
return 1
except OSError, (errno, strerror):
print 'Could not remove %s, %s' % (path,strerror)
return 0