Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile
-module(timeit).
-compile(export_all).
%% @doc Dynamically add timing to MFA. There are various types of
%% timing.
%%
%% all - time latency of all calls to MFA
%%
%% {sample, N, Max} - sample every N calls and stop sampling after Max
%%
@binarytemple
binarytemple / crash
Created May 15, 2014 19:31
vagrant crash
```
[120/1987]
GATHERING FACTS ***************************************************************
<10.42.0.6> ESTABLISH CONNECTION FOR USER: vagrant
<10.42.0.8> ESTABLISH CONNECTION FOR USER: vagrant
<10.42.0.7> ESTABLISH CONNECTION FOR USER: vagrant
<10.42.0.6> REMOTE_MODULE setup
<10.42.0.7> REMOTE_MODULE setup
<10.42.0.8> REMOTE_MODULE setup
<10.42.0.6> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/bryan/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Stric
@binarytemple
binarytemple / scala.html.parsing.markdown
Last active August 29, 2015 14:01
Scala html parsing

Some tricks for parsing html using Scala

import scala.xml.factory.XMLLoader
import scala.xml._
import scala.xml.parsing.{NoBindingFactoryAdapter}

object MyReader extends App {

//val parser1: XMLLoader[Elem] = XML.

Summary

I'm trying to figure out how to use rebar to:

  • create erlang project
  • add a dependency on an erlang module from github
  • start the app via the erl console
  • create a release and start the app from the release (via the generated scripts)
Fri 20 Jun 2014 23:20:03 BST
==> riak-03: Forcing shutdown of VM...
==> riak-03: Destroying VM and associated drives...
==> riak-03: Running cleanup tasks for 'ansible' provisioner...
==> riak-02: Forcing shutdown of VM...
==> riak-02: Destroying VM and associated drives...
==> riak-01: Forcing shutdown of VM...
==> riak-01: Destroying VM and associated drives...
Bringing machine 'riak-01' up with 'virtualbox' provider...
Bringing machine 'riak-02' up with 'virtualbox' provider...
#!/usr/bin/env python
import httplib
import json
from datetime import datetime, date, time
from time import sleep
import os.path
from multiprocessing import Process

Riak tricks

Bitcask, fill the key storage memory up by continously storing lots of objects with big keys and small data.

while true ; 
    do echo run ; 
 curl -XPUT -H "Content-Type: application/text" -d 'foo' "http://127.0.0.1:8098/riak/default/test$(date +"%s")${RANDOM}${RANDOM}$(seq 1 2200 | tr -d '\n') " ;
[~%]brew install scala
==> Downloading http://www.scala-lang.org/files/archive/scala-2.11.1.tgz
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/scala/scala-dist/27bc0c25145a83691e3678c7dda602e765e13413/completion.d/2.9.1/scala
######################################################################## 100.0%
==> Caveats
To use with IntelliJ, set the Scala home to:
  /usr/local/opt/scala/idea

Bash completion has been installed to:

import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
From 005be2e442074ea529ae0a188399eda553cb8783 Mon Sep 17 00:00:00 2001
From: evan <evan@basho.com>
Date: Tue, 18 Jun 2013 17:52:54 -0400
Subject: [PATCH] backport sfwi to R15B01
---
erts/emulator/beam/erl_init.c | 16 +++++++
erts/emulator/beam/erl_process.c | 89 ++++++++++++++++++++++++++++++++++++--
erts/emulator/beam/erl_process.h | 9 ++++
erts/etc/common/erlexec.c | 1 +