Skip to content

Instantly share code, notes, and snippets.

View kmader's full-sized avatar

Kevin Mader kmader

  • Zurich, Switzerland
View GitHub Profile
@ellisonbg
ellisonbg / test_basic.js
Created August 12, 2012 05:30
Simple test of IPython Notebook using phantomjs and casperjs
// Simple IPython Notebook test
// Requires PhantomJS and CasperJS.
// To run:
// 1) Start a notebook server in an empty directory.
// 2) casperjs test_basic.js
var casper = require('casper').create({
// verbose: true,
// logLevel: "debug"
});
@shivaram
shivaram / dataframe_example.R
Created June 2, 2015 23:54
DataFrame example in SparkR
# Download Spark 1.4 from http://spark.apache.org/downloads.html
#
# Download the nyc flights dataset as a CSV from https://s3-us-west-2.amazonaws.com/sparkr-data/nycflights13.csv
# Launch SparkR using
# ./bin/sparkR --packages com.databricks:spark-csv_2.10:1.0.3
# The SparkSQL context should already be created for you as sqlContext
sqlContext
# Java ref type org.apache.spark.sql.SQLContext id 1
@jfeala
jfeala / batch.py
Created April 18, 2017 12:33
AWS Batch wrapper for Luigi
"""
AWS Batch wrapper for Luigi
From the AWS website:
AWS Batch enables you to run batch computing workloads on the AWS Cloud.
Batch computing is a common way for developers, scientists, and engineers
to access large amounts of compute resources, and AWS Batch removes the
undifferentiated heavy lifting of configuring and managing the required
@oarriaga
oarriaga / spatial_transformer_network.py
Last active January 5, 2021 06:51
Implementation of Spatial Transformer Networks (https://arxiv.org/abs/1506.02025) in Keras 2.
from keras.layers.core import Layer
import keras.backend as K
if K.backend() == 'tensorflow':
import tensorflow as tf
def K_arange(start, stop=None, step=1, dtype='int32'):
result = tf.range(start, limit=stop, delta=step, name='arange')
if dtype != 'int32':
result = K.cast(result, dtype)
return result
@fperez
fperez / README.md
Last active July 1, 2021 04:43
Polyglot Data Science with IPython

Polyglot Data Science with IPython & friends

Author: Fernando Pérez.

A demonstration of how to use Python, Julia, Fortran and R cooperatively to analyze data, in the same process.

This is supported by the IPython kernel and a few extensions that take advantage of IPython's magic system to provide low-level integration between Python and other languages.

See the companion notebook for data preparation and setup.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dutc
dutc / retry.py
Last active February 21, 2023 19:32
Legitimately Bad Idea (`retry` decorator)
from functools import wraps
from itertools import islice, tee, zip_longest, chain, product
from collections import deque
from pandas import DataFrame
nwise = lambda g, *, n=2: zip(*(islice(g, i, None) for i, g in enumerate(tee(g, n))))
nwise_longest = lambda g, *, n=2, fv=object(): zip_longest(*(islice(g, i, None) for i, g in enumerate(tee(g, n))), fillvalue=fv)
first = lambda g, *, n=1: zip(chain(repeat(True, n), repeat(False)), g)
last = lambda g, *, m=1, s=object(): ((y[-1] is s, x) for x, *y in nwise_longest(g, n=m+1, fv=s))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
@dbieber
dbieber / fastbook.py
Last active August 10, 2023 18:13
fastbook speeds up the silence in audiobooks, and can speed up the non-silence too
"""Performs automatic speed edits to audio books.
Example usage:
Assuming you have an audiobook book.aax on your Desktop:
1. Convert it to wav:
ffmpeg -i ~/Desktop/book.aax ~/Desktop/book.wav
2. Adjust the speed: