Skip to content

Instantly share code, notes, and snippets.

View andreasjansson's full-sized avatar

Andreas Jansson andreasjansson

View GitHub Profile
@andreasjansson
andreasjansson / gist:1756937
Created February 7, 2012 03:22
palpitations
# Palpitations
# Copyright (C) 2012 <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@andreasjansson
andreasjansson / gist:4371022
Created December 24, 2012 23:19
One-liner to compile VST2.4 plugins on Linux. The magic is in the include path and the __cdecl defile.
g++ -D__cdecl="" -o test.so -shared -fPIC -I ~/src/vst/vstsdk2.4 adelay.cpp
def scaled_tanh(x, depth):
# scale [0, 255] to [-depth, depth]
x = x / (128.0 / depth) - depth
# apply tanh, scale now [-tanh(depth), tanh(depth)]
x = math.tanh(x)
# scale up again to [0, 255]
x = (x + math.tanh(depth)) * 128 / math.tanh(depth)
return x
def add_grain(im, depth=14):
pix = im.load()
width, height = im.size
pix = im.load()
for y in xrange(height):
for x in xrange(width):
pix[x, y] = tuple(map(lambda x: x + random.randint(-depth, depth),
list(pix[x, y])))
def add_grain(im, depth=14):
width, height = im.size
image = scipy.misc.fromimage(im)
code = '''
#include <stdlib.h>
int x, y, i;
int depth2 = depth * 2;
for(i = 0; i < width * height * 3; i ++) {
int x = image[i];
def gitio(url):
f = urllib2.urlopen(url='http://git.io', data='url=' + url)
return dict(f.info())['location']
[2013-03-26 13:42:44,939][DEBUG][http.netty ] [Human Torch II] Caught exception while handling client http traffic, closing connection [id: 0xd6f24dd4, /10.114.30.31:58582 :> /10.204.95.154:9200]
java.nio.channels.ClosedChannelException
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.cleanUpWriteBuffer(AbstractNioWorker.java:409)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:127)
at org.elasticsearch.common.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:99)
at org.elasticsearch.common.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:775)
at org.elasticsearch.common.netty.channel.Channels.write(Channels.java:725)
[2013-03-26 14:01:55,079][INFO ][node ] [Inza] {0.90.0.RC1}[21712]: initializing ...
[2013-03-26 14:01:55,079][DEBUG][node ] [Inza] using home [/opt/elasticsearch-0.90.0.RC1], config [/opt/elasticsearch-0.90.0.RC1/config], data [[/data]], logs [/opt/elasticsearch-0.90.0.RC1/logs], work [/opt/elasticsearch-0.90.0.RC1/work], plugins [/opt/elasticsearch-0.90.0.RC1/plugins]
[2013-03-26 14:01:55,085][INFO ][plugins ] [Inza] loaded [], sites []
[2013-03-26 14:01:55,096][DEBUG][common.compress.lzf ] using [UnsafeChunkDecoder] decoder
[2013-03-26 14:01:55,107][DEBUG][env ] [Inza] using node location [[/data/elasticsearch/nodes/0]], local_node_id [0]
[2013-03-26 14:01:56,612][DEBUG][threadpool ] [Inza] creating thread_pool [generic], type [cached], keep_alive [30s]
[2013-03-26 14:01:56,619][DEBUG][threadpool ] [Inza] creating thread_pool [index], type [cached], keep_alive [5m]
[2013-03-26 14:01:56,619][DEBUG]
index.number_of_shards: 1
index.number_of_replicas: 0
gateway.expected_nodes: 1
@andreasjansson
andreasjansson / .conkyrc
Last active December 15, 2015 13:59
macbook .conkyrc
out_to_console yes
out_to_x no
background no
update_interval 2
total_run_times 0
use_spacer left
short_units
no_buffers yes
TEXT