Skip to content

Instantly share code, notes, and snippets.

View michaelaye's full-sized avatar

Michael Aye michaelaye

View GitHub Profile
@michaelaye
michaelaye / 0_reuse_code.js
Created April 3, 2014 02:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
def render_split(time, color, offset = -4*pd.datetools.Minute(15)):
if(color is not None):
pl.gca().axvspan(
time + offset,
time + pd.datetools.Minute(15) + offset,
facecolor = pl.cm.Paired( float(color % 12)/12 ),
linewidth = 0,
alpha = 1.0,
)
{
"metadata": {
"name": "",
"signature": "sha256:2671bcf8ad936f12851c3856c8114fbd59a36e08903b1337ca903c79059900fd"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
<?xml version="1.0"?>
<root>
<deviceproductdef>
<productname>APPLE_INTERNAL_KEYBOARD_TRACKPAD_0x024c</productname>
<productid>0x024c</productid>
</deviceproductdef>
<deviceproductdef>
<productname>APPLE_WIRELESS_KEYBOARD_0x22c</productname>
<productid>0x22c</productid>
</deviceproductdef>
@michaelaye
michaelaye / raytracing.py
Created December 30, 2016 20:03 — forked from sklam/raytracing.py
Numba optimized raytracing. From 23seconds to 9seconds.
from __future__ import print_function, division
from timeit import default_timer as timer
import numpy as np
import matplotlib.pyplot as plt
from numba import njit
w = 400
h = 300
@michaelaye
michaelaye / raytracing.py
Created March 14, 2019 04:23 — forked from rossant/raytracing.py
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
.ipynb_checkpoints
@michaelaye
michaelaye / gitconfig.ini
Created June 9, 2020 17:04 — forked from tdd/gitconfig.ini
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases
@michaelaye
michaelaye / advanced_rasterio_features.ipynb
Created October 24, 2020 01:34 — forked from sgillies/advanced_rasterio_features.ipynb
Advanced Rasterio features notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michaelaye
michaelaye / remotemd5.py
Created October 7, 2021 02:09 — forked from brianewing/remotemd5.py
Python MD5 of remote file (URL)
import os, hashlib, urllib2, optparse
def get_remote_md5_sum(url, max_file_size=100*1024*1024):
remote = urllib2.urlopen(url)
hash = hashlib.md5()
total_read = 0
while True:
data = remote.read(4096)
total_read += 4096