Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wesm's full-sized avatar
💭
➡️ ➡️ ➡️

Wes McKinney wesm

💭
➡️ ➡️ ➡️
View GitHub Profile
@wesm
wesm / gist:11338078
Created April 27, 2014 05:15
Format JSON nicely in Emacs
(defun node-format ()
(interactive)
(save-excursion
(shell-command-on-region (mark) (point) "node -e \"process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (chunk) { eval('foo = ' + chunk); console.log(JSON.stringify(foo, null, 2));});\"" (buffer-name) t)
)
)
(global-set-key "\C-c\C-j" 'node-format)
@wesm
wesm / git_code_churn.py
Created September 8, 2011 03:02
Little script to get a time series of code churn (insertions, deletions) on a git repo
from dateutil import parser
import subprocess
import os
import re
import sys
import numpy as np
from pandas import *
@wesm
wesm / gist:1252447
Created September 30, 2011 01:44
AST magic to read variable names from prior stack frame
from pandas.util.testing import set_trace
import pandas.util.testing as tm
from pandas import *
import ast
import inspect
import sys
def merge(a, b):
f, args, _ = parse_stmt(inspect.currentframe().f_back)
@wesm
wesm / lightning.txt
Created October 7, 2011 14:31 — forked from pycodeconf/lightning.txt
PyCodeConf 2011 Lightning Talk Signup
I want to give a lightning talk about: pandas (http://pandas.sourceforge.net)
I need the projector: yes
@wesm
wesm / gist:1498531
Created December 19, 2011 19:34
qwt/PyQwt dependencies for procexp in Linux
svn co https://qwt.svn.sourceforge.net/svnroot/qwt/branches/qwt-5.2
cd qwt-5.2
qmake
make
sudo make install
now you're done with qwt
@wesm
wesm / groupsort.py
Created January 10, 2012 19:10
Stable O(max(n, k)) counting sort on n integers in range [0, ..., k - 1]
@cython.boundscheck(False)
@cython.wraparound(False)
def groupsort_indexer(ndarray[int32_t] index, Py_ssize_t ngroups):
cdef:
Py_ssize_t i, loc, label, n
ndarray[int32_t] counts, where, result
# count group sizes, location 0 for NA
counts = np.zeros(ngroups + 1, dtype='i4')
n = len(index)
@wesm
wesm / gist:335347239aa509bc1041
Created October 7, 2015 05:11
Hide Moments with Tampermonkey
// ==UserScript==
// @name Hide moments
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match https://twitter.com/*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
@wesm
wesm / SelfMerge.ipynb
Created September 17, 2012 18:47
Self merge example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wesm
wesm / gist:3831420
Created October 4, 2012 04:10
Parser shootout
# pylint: disable=W0612
import time
import pandas as pd
import numpy as np
import iopro
import gc
@wesm
wesm / gist:3904544
Created October 17, 2012 08:55
Foo
{
"metadata": {
"name": "Basics"
},
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "code",