Skip to content

Instantly share code, notes, and snippets.

@chancyk
chancyk / Sortable-Table.elm
Last active May 23, 2022 19:16
Simple Sortable Table in Elm
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing ( onClick )
import Array exposing ( Array )
-- Copied from elm-community/list-extra to remove the 3rd party
-- dependency so that the code can be pasted to: http://elm-lang.org/try
@chancyk
chancyk / excel_writer.py
Last active August 24, 2023 00:24
Python context manager for quickly writing tabular data to an Excel worksheet using xlwt or openpyxl.
import os
import re
import tempfile
from subprocess import Popen
from collections import OrderedDict
import xlrd
import xlwt
import xlutils
import openpyxl
@chancyk
chancyk / dedupe_clustering_behavior.ipynb
Last active August 29, 2015 14:03
Dedupe Clustering Behavior
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chancyk
chancyk / zope_textindex_profile
Created May 7, 2014 23:59
Profile of zope.index.TextIndex.apply
Line # Hits Time Per Hit % Time Line Contents
==============================================================
66 @profile
67 def apply(self, querytext, start=0, count=None):
68 8734 34597 4.0 0.3 parser = QueryParser(self.lexicon)
69 8734 1622182 185.7 14.1 tree = parser.parseQuery(querytext)
70 8645 2041557 236.2 17.7 results = tree.executeQuery(self.index)
71 8645 12093 1.4 0.1 if results:
72 8645 675324 78.1 5.9 qw = self.index.query_weight(tree.terms())
73
@chancyk
chancyk / install_dedupe_ubuntu_12.04.txt
Created March 28, 2014 16:47
Successful steps for installing dedupe in a fresh Ubuntu 12.04 docker container.
cd ~
sudo apt-get update
sudo apt-get install wget
wget --no-check-certificate https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
sudo apt-get install git
mkdir src
cd src
git clone http://github.com/datamade/dedupe
cd dedupe/
import multiprocessing
import os
import time
import Queue
def scoring_function_dummy(jobs, results):
while True:
try:
task = jobs.get(True, 1)
print '%s: working: %s' % (os.getpid(), task)