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
====================================================== | |
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10 | |
====================================================== | |
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu | |
8.10. The article is targeted at a production environment, but keep in mind | |
this is a more generalized environment. You may have different requirements, | |
but this article should at least provide the stepping stones. | |
The article will use distribution packages where nesscary. As of 8.10 the |
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 | |
import matplotlib.pyplot as plt | |
import scipy | |
from scipy.interpolate import interp1d | |
import math | |
PSD = np.array([[0.001,1.0e-8], | |
[5.0, 0.001], | |
[25.0, 0.03], | |
[30.0, 0.03], |
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
for name in *.ogg; do ffmpeg -ab 192k -i "$name" -map_meta_data 0:0,s0 "$(basename "$name" .ogg).mp3"; done; |
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
# For 9.10 to 10.10 | |
sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update | |
sudo apt-get install ffmpeg libavcodec-extra-52 |
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 numpy import sqrt, cos, sin, exp, arange, amax, absolute | |
from math import pow | |
from matplotlib import * | |
from pylab import * | |
def theta_func(L, g, m, x): | |
tmp = (179.5*pow(g,3./2.)*L*sin((sqrt(g)*x)/sqrt(L))*sin(x*(3.132-sqrt(g)/sqrt(L)))-\ | |
179.5*pow(g,3./2.)*L*cos((sqrt(g)*x)/sqrt(L))*cos(x*(3.132-sqrt(g)/sqrt(L)))-\ | |
5514.8*pow(L,5./2.)*sin((sqrt(g)*x)/sqrt(L))*sin(x*(3.132-sqrt(g)/sqrt(L)))+\ | |
5514.8*pow(L,5./2.)*cos((sqrt(g)*x)/sqrt(L))*cos(x*(3.132-sqrt(g)/sqrt(L)))+\ |
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 numpy import sin, cos | |
import scipy | |
from scipy.integrate import odeint | |
from scipy import arange, array | |
def func(y, t, L, S, g, c, scale): | |
theta = y[0] | |
d_theta_dt = y[1] | |
return (d_theta_dt, -g/L*sin(theta)-scale*S(t)/L*cos(theta)-c*d_theta_dt) |
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 subprocess | |
import os | |
import argparse | |
import pp | |
''' | |
Parallel transcoding of ogg files to mp3. And yes, lossy to lossy is a bad idea. | |
Needed to do this since Google's Music Beta doesn't support ogg and that's the | |
format in which my music is encoded. | |
This works on linux (ffmpeg), and needs the uncrippled ffmpeg (mp3 support, http://ubuntuforums.org/archive/index.php/t-1117283.html) |
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 os | |
import sys | |
import odbAccess | |
from glob import glob | |
import re | |
from collections import defaultdict | |
import numpy as NP | |
import subprocess | |
def open_odb(odbPath): |
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
for i,(time,temp) in enumerate(time_temp): | |
if not (i % 4): | |
f_amp.write('\n') | |
f_amp.write('%s,%s,' % (time,temp)) | |
f_amp.write('\n') |
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
def uniquefy(seq, idfun=None): | |
# order preserving | |
if idfun is None: | |
def idfun(x): return x | |
seen = {} | |
result = [] | |
for item in seq: | |
marker = idfun(item) | |
# in old Python versions: | |
# if seen.has_key(marker) |
OlderNewer