Skip to content

Instantly share code, notes, and snippets.

View aurora's full-sized avatar
🤔
...

Harald Lapp aurora

🤔
...
View GitHub Profile
@aurora
aurora / counter.py
Created October 13, 2012 17:39 — forked from ericmoritz/counter.py
A counter stored in Riak that handles conflict resolutions on read
import logging
import riak
log = logging.getLogger(__name__)
class RiakCounter(object):
def __init__(self, bucket, key):
self.bucket = bucket
self.bucket.set_allow_multiples(True)
self.key = key
@aurora
aurora / gist:3892372
Created October 15, 2012 13:08 — forked from arcusfelis/gist:1171281
CLDR Collation Erlsom Model
{type,collation,sequence,
[{el,[{alt,suppress_contractions,'collation/SEQ1',[],1,1,false,
undefined},
{alt,special,'collation/SEQ1',[],1,1,false,undefined},
{alt,settings,'collation/SEQ1',[],1,1,false,undefined},
{alt,rules,'collation/SEQ1',[],1,1,false,undefined},
{alt,optimize,'collation/SEQ1',[],1,1,false,undefined},
{alt,base,'collation/SEQ1',[],1,1,false,undefined},
{alt,alias,alias,[],1,1,true,undefined}],
1,1,7}],
@aurora
aurora / gist:3921522
Created October 20, 2012 00:54
Erlang + Riak notes
1. It may be required to install Riak on OSX from source. This may be the case, when Riak is reporting
an error reading "app.config" when trying to start the Riak server after installation.
2. A successfully started Riak server can be tested by visiting the URL http://127.0.0.1:8098/ping, the
port may differ, it can be looked up in the "app.config" file.
3. To connect to Riak from Erlang it's recommended to use the Riak protobuf client which can be
found at: https://github.com/basho/riak-erlang-client
4. When installing the protobuf client the client and all libraries below the "deps/" directory of the
@aurora
aurora / pbstream.erl
Created October 26, 2012 14:41 — forked from adamhunter/pbstream.erl
riak-erlang-client streaming mapreduce examples
-module(pbstream).
-export([load/1, keys/0, bucket/0, map/3, pb_link/0, pb_link/2]).
-define(QUERY, [{map, {modfun, riak_kv_mapreduce, map_object_value}, <<"filter_notfound">>, true}]).
load(HowMany) ->
lists:foreach(fun(Index) ->
BIndex = list_to_binary(integer_to_list(Index)),
RObj = riakc_obj:new(<<"examples">>, <<"key",BIndex/binary>>, <<"Value ",BIndex/binary>>),
@aurora
aurora / gist:4107057
Created November 18, 2012 19:34
Riak build notes on UltraSparc-60 64Bit

OpenCWS

The following packages need to be installed before compiling erlang:

  • gcc4core
  • gcc4g++
  • gmake
  • unixodbc, unixodbc_dev
  • libssl_dev
SUMMARY
I like to use kcachegrind for doing profiling on my ruby code. Most of my development
is done on OSX, and while you can install kcachegrind via macports, it takes forever
because it has to build KDE, as well. Much to my surprise, the fine folks who
wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on
OSX without too much effort, only having to install QT and GraphViz. Yippie!
I'm running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I'm sure
it will build just fine on earlier versions of Xcode, but I haven't tested it.
harald@********:~/ioping-0.6$ ./ioping -c 10 .
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=1 time=2.8 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=2 time=2.0 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=3 time=1.0 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=4 time=5.7 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=5 time=1.0 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=6 time=6.9 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=7 time=1.0 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=8 time=2.7 ms
4096 bytes from . (ext4 /dev/disk/by-uuid/a6d22aee-c0b7-401d-b1be-3c0e0a6205e2): request=9 time=3.0 ms
$_t = preg_replace('/((^| )([a-z]:|)\d+([^\w]|$)|[\x21-\x2f\x5b-\x60\x7b-\xff])/i', '', trim($_t));
@aurora
aurora / gist:6769307
Created September 30, 2013 20:01
Brother HL-5140 Trommelreset
Frontklappe öffnen
Taste "GO" festhalten bis alle Lampen leuchten
Frontklappe schliessen
3x GO drücken
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.open(file).each do |line|
if line.start_with?('#viscosity name')