This file contains hidden or 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
#include <iostream> | |
#include <sndfile.h> | |
using namespace std; | |
/** | |
* Convert an audio file to mono format (input in first arg, output in second) | |
*/ | |
int main(int argc, char** argv) | |
{ | |
if (argc != 3) |
This file contains hidden or 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 | |
import os | |
import optparse | |
def processfile(fi, fo) : | |
print 'lame --decode --quiet %s %s' % (fi,fo) | |
if __name__ == '__main__': | |
# parse options | |
parser = optparse.OptionParser() |
This file contains hidden or 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
// print out a vector of type T on stdout | |
template <typename T> | |
void printClVector(cl_mem &clVector, int length, cl_command_queue &commands, int printrowlen = -1) | |
{ | |
T *tmp = new T[length]; | |
int err = clEnqueueReadBuffer(commands, clVector, CL_TRUE, 0, sizeof(T) * length, tmp, 0, NULL, NULL ); | |
if (err != CL_SUCCESS) | |
{ | |
printf("Error: Failed to read output array! %d\n", err); | |
exit(1); |
This file contains hidden or 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/Rscript | |
d <- as.matrix(read.csv2(file("stdin"), header=FALSE, sep=",")) | |
ca <- commandArgs(trailingOnly=TRUE) | |
pdf(file=ca[1], width=12, height=6) | |
plot(d[,1:2], type='n') | |
lines(d) | |
dev.off() |
This file contains hidden or 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
class Filter(object): | |
""" Linear Filter, notation is similar to matlab's filter function """ | |
def __init__(self, b, a, xinit, yinit): | |
self.b = np.array(b) | |
self.a = np.array(a) | |
self.x = np.array(xinit)[::-1] | |
self.y = np.array(yinit)[::-1] | |
def tick(self, x) : |
This file contains hidden or 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
# subplots: | |
layout(matrix(c(1,2), 2, 1, byrow = TRUE)) # first matrix defines "occupancy" | |
# then do all the plot() commands, one per figure | |
dev.new(width,height) | |
# FONT STUFF | |
par(family="serif") | |
plot(x,y, log="x", type='l', xlab='blabla', ylab='blabla', axes=FALSE) |
This file contains hidden or 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
# list of lists: | |
import itertools | |
list(itertools.chain.from_iterable(a)) | |
# logging stuff | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
logging.debug('This message should go to the log file') | |
logging.info('So should this') |
This file contains hidden or 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
#let's say f_TI is something like | |
#void blabla(int *data, int data_length); | |
#then | |
f_TI.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.c_int] | |
lll = [4,7,2,8] | |
lll_c = (ctypes.c_int * len(lll))(*lll) | |
f_TI(lll_c, len(lll)) |
This file contains hidden or 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
merge two libs: | |
lipo -create libfftw3f-i386.a libfftw3f-ppc.a -output libfftw3f.a |
OlderNewer