Skip to content

Instantly share code, notes, and snippets.

@NelsonMinar
NelsonMinar / Pandas-MultiIndex-slicing-demo.ipynb
Created September 17, 2016 19:32
Pandas MultiIndex slicing demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NelsonMinar
NelsonMinar / winrates.ipynb
Created September 16, 2016 00:31
League of Legends win rates by tier
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NelsonMinar
NelsonMinar / close.py
Created March 30, 2016 00:35
Demo program for a small bug with discord.py closing sessions
# Demo of a bug in discord.py 0.10.0-alpha (tested with 53a240e)
# This program causes the following error to be printed when Python exits
# Unclosed client session
# client_session: <aiohttp.client.ClientSession object at 0x7f3bd7a83358>
import discord
c = discord.Client()
c.close()
.bail on
begin transaction;
update globals set value=4 where name='dbSchemaVersion';
-- remove lastGamesSince
delete from globals where name = 'lastGamesSince';
-- add a processed column and fill it with a value
#!/usr/bin/env python3
"A simple discord.py program to log in and receive and post messages"
# Configure these for a valid Discord account to log in as
email = FILL IN EMAIL
password = FILL IN PASSWORD
# Logging configuration. Go to DEBUG level if you want much more detail
import logging
@NelsonMinar
NelsonMinar / python-json-types.py
Created January 10, 2016 23:07
Testing various dict wrappers for Python JSON
"""
Various options for a JSON type for Python.
My best effort at using these libraries naturally for reading and writing JSON.
https://nelsonslog.wordpress.com/2016/01/08/a-better-python-object-for-json/
"""
import json, copy
import dotmap, attrdict, easydict, addict
@NelsonMinar
NelsonMinar / coursera-ex6.ipynb
Created September 21, 2015 21:42
SVM with Gaussian experiements in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NelsonMinar
NelsonMinar / bf4plots.ipynb
Last active February 14, 2017 23:24
Battlefield 4 plots, an IPython experiment
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python2
"""Demonstrate a bug in unicodecsv with non-ASCII headers
In version 0.11.0 this works fine.
In version 0.11.1 it throws an error when writing the header."""
import unicodecsv
print "Unicode CSV version %s" % (unicodecsv.__version__)
fp = file("out.csv", "wb")