Skip to content

Instantly share code, notes, and snippets.

View takluyver's full-sized avatar

Thomas Kluyver takluyver

View GitHub Profile
@takluyver
takluyver / gist:10509891
Created April 11, 2014 23:40
codejam wrapper
problem = 'A-sample'
fin = open(problem + '.in')
fout = open(problem + '.out')
def read_ints():
return [int(x) for x in fin.readline().strip().split()]
T = read_ints()
for caseno in range(T):
@takluyver
takluyver / expsuite.py
Created April 19, 2014 00:26
Python Experiment Suite on Python 3
#############################################################################
#
# PyExperimentSuite
#
# Derive your experiment from the PyExperimentSuite, fill in the reset() and
# iterate() methods, and define your defaults and experiments variables
# in a config file.
# PyExperimentSuite will create directories, run the experiments and store the
# logged data. An aborted experiment can be resumed at any time. If you want
# to resume it on iteration level (instead of repetition level) you need to
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ItemStatusChecker.py
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy import log, signals
from site_scraper.spiders.scrape1 import MySpider
from scrapy.utils.project import get_project_settings
import wx
@takluyver
takluyver / kernelbase.diff
Created June 6, 2014 01:26
IPython kernel base class refactoring
--- ipkernel.py 2014-06-05 18:24:50.657690648 -0700
+++ kernelbase.py1 2014-06-05 18:08:47.899279566 -0700
@@ -1,14 +1,12 @@
-"""An interactive kernel that talks to frontends over 0MQ."""
+"""Base class for a kernel that talks to frontends over 0MQ."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
Not Critical
DNS Name: ssl6508.cloudflare.com
DNS Name: *.tax-i.co
DNS Name: *.e-tasawak.com
DNS Name: e-tasawak.com
DNS Name: *.tixbox.com
DNS Name: tableagent.com
DNS Name: *.shunga.com
DNS Name: *.therighthairstyles.com
DNS Name: *.tableagent.com
@takluyver
takluyver / __init__.py
Created September 25, 2014 01:13
osgeo/__init__.py modification
# __init__ for osgeo package.
# making the osgeo package version the same as the gdal version:
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
@takluyver
takluyver / JS link alternate.ipynb
Created October 22, 2014 17:21
Alternate frontend linking using comms
@takluyver
takluyver / write_nsi_template.py
Created November 16, 2014 00:37
Pynsist nsi template rewritten as Python
from nsist.nsigen import *
Document([
Comment('Definitions will be added above'),
Instruction('SetCompressor', 'lzma'),
Instruction('RequestExecutionLevel', 'admin'),
'',
Comment("Modern UI installer stuff"),
CompilerCommand("include", "MUI2.nsh"),
define("MUI_ABORTWARNING"),
@takluyver
takluyver / nsigen.py
Created December 18, 2014 22:27
nsigen.py
class Comment(object):
def __init__(self, content):
self.content = content
def generate(self, state=None):
yield "; " + self.content
def _should_quote(arg):
return (' ' in arg) or ('$' in arg)
@takluyver
takluyver / mapplot.py
Created March 25, 2015 17:09
Plot TDWG region data
#!/usr/bin/python
# coding: utf-8
"""
Adapted from BaseMap example by geophysique.be
tutorial 07
http://www.geophysique.be/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/
"""
import numpy as np
import matplotlib as mpl