Skip to content

Instantly share code, notes, and snippets.

alias p python3
alias p2 python2
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias python="python3"
alias m='python manage.py'
<!-- START SIGMA IMPORTS -->
<script src="../src/sigma.core.js"></script>
<script src="../src/conrad.js"></script>
<script src="../src/utils/sigma.utils.js"></script>
<script src="../src/utils/sigma.polyfills.js"></script>
<script src="../src/sigma.settings.js"></script>
<script src="../src/classes/sigma.classes.dispatcher.js"></script>
<script src="../src/classes/sigma.classes.configurable.js"></script>
<script src="../src/classes/sigma.classes.graph.js"></script>
<script src="../src/classes/sigma.classes.camera.js"></script>
function logtitle(x) {
document.title = x
console.log(x)
}
function milli2nice(m) {
var r = Math.round(m*1000)/1000;
return r+"ms"
}
@mdamien
mdamien / parse.py
Created July 28, 2015 10:09
Parse wikidata via json streaming
import json
from pprint import pprint as pp
from ijson import items
COMPANIES = [
783794, #company
279014, #european society
134161, #join stock
33685, #limited company
@mdamien
mdamien / import.py
Created August 4, 2015 13:21
Parse StackOverflow & StackExchange
import xmltodict, json, sys, os
from os.path import join
SPECIFIC_DIR = sys.argv[1].replace('extracted/','') if len(sys.argv) > 1 else None
DIRS = [SPECIFIC_DIR] if SPECIFIC_DIR else os.listdir('extracted/')
for DIR in DIRS:
print(DIR)
DIR2 = 'extracted/'+DIR
@mdamien
mdamien / commit.py
Last active August 29, 2015 14:26
Commit large dataset to neo4j by splitting
#this is a scrappy and inefficient solution but it works ;)
def commit(*data, total=None, progress=0):
if not total:
total = len(data)
L = len(data)
print(' ', progress,'/',total,'... +',L)
try:
if L > 1000:
raise Exception('split it')
<!-- START SIGMA IMPORTS -->
<script src="../src/sigma.core.js"></script>
<script src="../src/conrad.js"></script>
<script src="../src/utils/sigma.utils.js"></script>
<script src="../src/utils/sigma.polyfills.js"></script>
<script src="../src/sigma.settings.js"></script>
<script src="../src/classes/sigma.classes.dispatcher.js"></script>
<script src="../src/classes/sigma.classes.configurable.js"></script>
<script src="../src/classes/sigma.classes.graph.js"></script>
<script src="../src/classes/sigma.classes.camera.js"></script>
@mdamien
mdamien / ita.md
Last active December 14, 2017 13:07

The founder of Mixergy.com, home of the ambitious upstart. The place where over a thousand of entrepreneurs have come to tell the stories of how they built their businesses, had challenges along the way, overcame them, or not, and mostly told you what they learned from it. And thousands and thousands and thousands of other entrepreneurs have listened and learned, and used what they’ve learned from these interviews.

Today’s guest is David Baggett. He co-founded ITA software, a company that Google bought for a reported $700 million. ITA makes software that’s the search engine behind sites like Kayak. It actually figures out prices, time and other data like flights.

Today, after selling, he launched, and is running, Inky, a mobile app that makes clearing your inbox easier. It will categorize your email for you., it will help you unsubscribe from junk. And it will let you quickly respond to what’s important.

I invited him here to talk about his past companies. And personally he’s a guy wh

@mdamien
mdamien / parse.py
Created August 20, 2015 15:28
find companies in wikidata
import json
from pprint import pprint as pp
from ijson import items
COMPANIES = [
783794, #company
279014, #european society
134161, #join stock
33685, #limited company
@mdamien
mdamien / pb.py
Created September 14, 2015 06:29
"""
Given an int array which might contain duplicates,
find the largest subset of int which form a sequence.
Eg. {1,2,10,4,7,9,5}
then ans is 4,5,6,7
Sorting is an obvious solution. Can this be done in O(n) time
"""
def find_easy(arr):