Skip to content

Instantly share code, notes, and snippets.

@mdengler
mdengler / README.md
Last active October 11, 2017 02:32
SugarLabs clock device patch and mockups
#!/usr/bin/env python
import json
import random
filename = "test.json"
x = [{"ID": i,
"xxx": "".join(["f"] * random.randint(1, 20)),
"yyy": "".join(["f"] * random.randint(1, 20))}
for i in range(20)]
#!/usr/bin/env python
"""
Proof of concept scraper for pinnacle sports
@mdengler
mdengler / slice panel4d
Created June 10, 2016 03:25
panel4d iloc and slices?
>>> p4 = pd.Panel4D({i: pd.Panel({j: pd.DataFrame(range(10)) for j in range(10)}) for i in range(10)})
>>> p4.iloc[:,:,0]
<class 'pandas.core.panel.Panel'>
Dimensions: 10 (items) x 10 (major_axis) x 1 (minor_axis)
Items axis: 0 to 9
Major_axis axis: 0 to 9
Minor_axis axis: 0 to 0
>>> p4.iloc[slice(None), slice(None), slice(0)]
<class 'pandas.core.panelnd.Panel4D'>
Dimensions: 10 (labels) x 10 (items) x 0 (major_axis) x 1 (minor_axis)
every_nth = [2, 3]
index = pd.Series(range(len(df.index))) # or just df.index if it's already the 0-indexed indices
mask = reduce(np.logical_or, [index % i == 0 for i in every_nth])
df[mask.astype(bool).values]
@mdengler
mdengler / gist:7042133
Created October 18, 2013 14:11
mpl_tm.py
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
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.
@mdengler
mdengler / install-tmux
Last active October 19, 2015 22:46 — forked from rothgar/install-tmux
Install tmux 2.1 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=$HOME &&