This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cython: boundscheck=False, wraparound=False | |
import numpy as np | |
cimport numpy as np | |
from cython.parallel cimport prange | |
def dot(np.ndarray[np.float32_t, ndim=2] a not None, | |
np.ndarray[np.float32_t, ndim=2] b not None, | |
np.ndarray[np.float32_t, ndim=2] out=None): | |
"""Naive O(N**3) 2D np.dot() implementation.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from icyexecnetgateway import IcyExecnetGateway | |
# setups a remote python interpreter and returns the associated gateway | |
with IcyExecnetGateway() as gateway: | |
# print some text in the remote interpreter | |
# it will be sent to Icy and printed in the console output of Icy's Script Editor | |
gateway.remote_exec("""print "Hello from remote Python" """) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SSH into a Vagrant VM, forwarding ports in a way that allows node within Vagrant to be debugged by a debugger | |
# or IDE in the host operating system. Don't know why, but Vagrantfile port forwarding does not work. | |
# (https://groups.google.com/forum/#!topic/vagrant-up/RzPooJ0dp6Q) | |
/usr/bin/vagrant ssh-config > $TMPDIR/vagrant-ssh-config | |
ssh -F $TMPDIR/vagrant-ssh-config -L 5858:127.0.0.1:5858 default | |
rm $TMPDIR/vagrant-ssh-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
1. Go to https://dev.moves-app.com/apps and register a new app. | |
client_id and client_secret will be given, so paste it to the variables below. | |
2. `$ python moves-fetch.py --requesturl` will open the web browser. | |
Follow the instructions and authenticate the app. | |
You will be redirected to a web page with an error message. | |
Copy the string between `code=` and `&`. | |
That is your request_token, so paste it below. | |
3. `$ python moves-fetch.py --accesstoken` will output access token to stdout. | |
Copy the token and paste it below. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from flask import Flask, abort, request | |
from uuid import uuid4 | |
import requests | |
import requests.auth | |
import urllib | |
CLIENT_ID = None # Fill this in with your client ID | |
CLIENT_SECRET = None # Fill this in with your client secret | |
REDIRECT_URI = "http://localhost:65010/reddit_callback" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"graph": [], | |
"links": [ | |
{"source": 0, "target": 1}, | |
{"source": 0, "target": 2}, | |
{"source": 0, "target": 3}, | |
{"source": 0, "target": 4}, | |
{"source": 0, "target": 5}, | |
{"source": 0, "target": 6}, | |
{"source": 1, "target": 3}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install build-essential python-dev | |
sudo apt-get install python-matplotlib | |
sudo apt-get install python-pip | |
sudo pip install ipython-sql | |
sudo pip install --upgrade jinja2 tornado jsonschema pyzmq | |
sudo apt-get install python-mysqldb | |
# let's start ipython notebook | |
ipython notebook --ip=0.0.0.0 # port-forwarding doesn't work without this --ip flag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stop all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ] ; then | |
docker stop $containers | |
fi | |
# Delete all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ]; then | |
docker rm -f -v $containers |
OlderNewer