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
# commands to get the links (bash) | |
# $ wget -c -r --no-parent -k -U Mozilla http://www.ctc.org.nz/ | |
# $ find ./www.ctc.org.nz/ -name "*gpx*" > gpxfiles.txt | |
# gpxfiles.txt has the numbers used in the script below | |
import re | |
import os | |
import requests | |
numberlist = [6,92,32,86,4,28,27,103,75,46,90,91,1,10,35,97,20,72,52,69,9,12,96,22,40,102,78,14,82,99,83,84,51,58,42,79,55,26,81,53,76,39,56,3,80,45,77,94,60,47,33,95,36,48,2,50,24,25,71,88,16,89,23,11,98,49,31,18,57,13,19,43,61,44,54,74,37,93,7,85,59,104,100,73,8,30,101,41,34,17,38,70,29,21,15,5,87] |
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
function newCurve = spline3d(curve, dt) | |
% interpote a 3d curve using spline | |
% path 3*x | |
% newPath 3*x | |
x = curve(1, :); | |
y = curve(2, :); | |
z = curve(3, :); | |
t = cumsum([0;sqrt(diff(x(:)).^2 + diff(y(:)).^2 + diff(z(:)).^2)]); | |
sx = spline(t,x); | |
sy = spline(t,y); |
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
function gplot3(A, xyz) | |
% GPLOT3(A, xyz) is nearly the same as GPLOT(A, xy) except | |
% that the xyz variable requires a third dimension. | |
% This function takes an adjacency matrix and visualizes it | |
% in 3D. | |
[d e] = size(A); | |
if d ~= e | |
error('A matrix must be square.'); | |
end |
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
function quickPlot(varargin) | |
% Quickly plot point clouds of data. | |
% This works for up to 5 datasets of | |
% 1D or 2D or 3D data, regardless of the | |
% row-order or column-order format. | |
% | |
% Also works with 2D or 3D matrices. | |
% | |
% How to use this function: | |
% --> Give it data. That's pretty much it. |
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
import urllib | |
import sys | |
import re | |
troll = "dQw4w9WgXcQ" | |
urlsource = sys.argv[1] | |
f = urllib.urlopen(urlsource) | |
s = f.readlines() |
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
%a = kelly(:) | |
%b = repmat([1:1:14]',8,1) | |
%c = kron([1:1:8],ones(1,14))' | |
%d = [ b, c] | |
%hist3(a,{ b c }) | |
kelly1 = kelly'; | |
close all | |
figure() |
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
var request = require('request') | |
, path = require('path') | |
, fs = require('fs') | |
, url = "https://api.github.com/users/thomastraum/gists" | |
, savepath = './gists'; | |
request(url, function (error, response, body) { | |
if (!error && response.statusCode == 200) { |
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 | |
# Clone or update all a user's gists | |
# curl -ks https://raw.github.com/gist/5466075/gist-backup.py | python | |
# curl -ks https://raw.github.com/gist/5466075/gist-backup.py | USER=fedir python | |
# USER=fedir python gist-backup.py | |
import json | |
import urllib | |
from subprocess import call | |
from urllib import urlopen |
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
In [1]: import numpy as np | |
In [2]: from scipy.spatial.distance import cdist | |
In [3]: from distlib import pairwise_cython_blas, pairwise_cython | |
In [4]: a = np.random.random(size=(1000,3)) | |
In [5]: %timeit cdist(a,a) | |
100 loops, best of 3: 11.3 ms per loop |
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
import numpy as np | |
from collections import deque | |
import time | |
import threading | |
import matplotlib.pyplot as plt | |
def rollingFFT(s, n, dt): | |
fy = np.fft.fft(s) | |
# Frequencies associated with each samples |
OlderNewer