brew install homebrew/dupes/expect
unbuffer ./blablabla | ... | ...
| Force git to overwrite local files on pull (fixed homebrew w/ this) | |
| git fetch --all | |
| git reset --hard origin/master | |
| find ip address from cmdline | |
| wget -qO- http://ipecho.net/plain ; echo | |
| def sample_discrete(probabilities): | |
| bins = np.add.accumulate(probabilities) | |
| return np.digitize([random.random()], bins) |
| cmake_minimum_required(VERSION 2.6) | |
| project(ml) | |
| add_library(boost_po STATIC IMPORTED) | |
| set_property(TARGET boost_po PROPERTY | |
| IMPORTED_LOCATION /usr/local/lib/libboost_program_options.a) | |
| set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++") |
| add this stuff: | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <artifactId>maven-assembly-plugin</artifactId> | |
| <configuration> | |
| <archive> | |
| <manifest> | |
| <mainClass>com.nicolamontecchio.gnappo.Gnappo</mainClass> |
| merge two libs: | |
| lipo -create libfftw3f-i386.a libfftw3f-ppc.a -output libfftw3f.a |
| #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)) |
| # 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') |
| # 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) |
| 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) : |