Skip to content

Instantly share code, notes, and snippets.

pkg: galactus
vagrant up
cp /tmp/galactus*.deb . && vagrant destroy
galactus:
git clone /Users/ksmith/work/repos/galactus galactus
@kevsmith
kevsmith / hangout
Created March 20, 2014 17:25
Join any hangout on our corp Google account from the terminal
Example:
> hangout ted
<Browser tab opens and connects to the ted hangout>
@kevsmith
kevsmith / gist:9650734
Created March 19, 2014 20:42
galactus release tagging
➜ galactus git:(release) make tagrelease vsn=0.1
PKG_VERSION=0.1
PKG_MAINTAINER = [email protected]
PROVIDES = galactus
RELEASE_BRANCH = release
rebar lock-deps
==> jiffy (lock-deps)
==> cowlib (lock-deps)
==> ranch (lock-deps)
==> cowboy (lock-deps)
def test_create_dupe_user():
> api.create_user(USER_TESTY, api.ADMIN_TOKEN, validate=v.write_success)
test_user.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
user = {'email': '[email protected]', 'first_name': 'Tess', 'last_name': 'Testerson', 'password': 'testing', ...}, token = 'burritos4lyfe', validate = <function write_success at 0x10a621b90>
def create_user(user, token, validate=None):
resp = requests.post(build_url('users', user['username']),
@kevsmith
kevsmith / osx_clipboard.el
Last active October 29, 2016 13:49
osx_clipboard.el
(setq interprogram-cut-function
(lambda (text &optional push)
(let* ((process-connection-type nil)
(pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy")))
(process-send-string pbproxy text)
(process-send-eof pbproxy))))
(setq interprogram-paste-function
(lambda ()
(shell-command-to-string "pbpaste")))
@kevsmith
kevsmith / test_monitor.cpp
Created January 8, 2014 19:23
Weird non-blocking behavior on ZMQ_PAIR sockets.
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2011 250bpm s.r.o.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
@kevsmith
kevsmith / console
Created April 17, 2013 15:56
Automating common record operations
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:true] [dtrace]
Eshell V5.10.1 (abort with ^G)
1> record_demo:record_names().
[foo,bar,baz]
2> A = [{<<"a">>, 1}, {<<"b">>, 2}, {<<"c">>, 3}].
[{<<"a">>,1},{<<"b">>,2},{<<"c">>,3}]
3> B = [{"g", 5}, {"h", 7}, {"i", 9}].
[{"g",5},{"h",7},{"i",9}]
4> C = [{d, 11}, {e, 13}, {f, 15}].
@kevsmith
kevsmith / bench.erl
Last active December 14, 2015 07:09
Simple Erlang message passing benchmark
-module(bench).
-export([run_suite/3, run/1]).
run_suite(Name, Passes, Messages) ->
Results = run_suite1(Passes, Messages, []),
Avg = lists:sum(Results) / Passes,
StdDev = math:sqrt(lists:sum([math:pow(X - Avg, 2) || X <- Results]) / Passes),
Summary = [{avg, Avg}, {stddev, StdDev}, {min, lists:min(Results)},
{max, lists:max(Results)}],
@kevsmith
kevsmith / Example
Created December 10, 2012 20:48
Find all processes executing code from a given module
12> F = fun(P, {current_function, {Mod, _, _}}) -> {P, Mod} end,
12> C = fun(Mod, Prefixes) -> lists:sum([string:str(Mod, Prefix) || Prefix <- Prefixes]) > 0 end,
12> Target = fun(Prefixes) -> Candidates = [F(P, erlang:process_info(P, current_function)) || P <- erlang:processes()],
12> [{Pid, Mod} || {Pid, Mod} <- Candidates,
12> C(atom_to_list(Mod), Prefixes)] end.
#Fun<erl_eval.6.82930912>
13> Target(["erl"]).
[{<0.3.0>,erl_prim_loader},{<0.33.0>,erl_eval}]
14>
@kevsmith
kevsmith / gist:4225773
Created December 6, 2012 16:24
Running OTP release under gdb
➜ opscode-pushy-server git:(master) ✗ bin/opscode-pushy-server dbg
=====
Starting opscode-pushy-server in debug mode...
=====
Reading symbols for shared libraries .. done
warning: Could not find object file "/Users/ksmith/Downloads/otp_src_R15B01/erts/obj/i386-apple-darwin11.2.0/erlexec.o" - no debug information available for "erlexec.c".