Skip to content

Instantly share code, notes, and snippets.

@flowerett
flowerett / erl_prof2.erl
Created August 28, 2020 07:45
Erlang profiling - Fprof
recover(VHost) ->
%% Put different profiling outputs to different files
FProfFile = lists:flatten(io_lib:format("/tmp/prof-~s.prof", [VHost])),
%% Start the tracer
fprof:trace(start),
VHostDir = rabbit_vhost:msg_store_dir_path(VHost),
rabbit_log:info("Making sure data directory '~s' for vhost '~s' exists~n",
[VHostDir, VHost]),
VHostStubFile = filename:join(VHostDir, ".vhost"),
ok = rabbit_file:ensure_dir(VHostStubFile),
@flowerett
flowerett / erl_prof.erl
Created August 28, 2020 07:44
Erlang profiling - eprof
recover(VHost) ->
%% Put different outputs to separate files.
EProfFile = lists:flatten(io_lib:format("/tmp/eprof-~s.prof", [VHost])),
%% Start eprof server.
eprof:start(),
%% Run the code while profiling.
eprof:profile(
fun () ->
VHostDir = rabbit_vhost:msg_store_dir_path(VHost),
rabbit_log:info("Making sure data directory '~s' for vhost '~s' exists~n",
@flowerett
flowerett / phx-1.4-upgrade.md
Created November 9, 2018 09:34 — forked from chrismccord/phx-1.4-upgrade.md
Phoenix 1.3.x to 1.4.0 Upgrade Guides

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Install the new phx.new project generator

The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.

To grab the new archive, simply run:

@flowerett
flowerett / git_submodules_merge.md
Last active July 4, 2018 11:05
Merge two git repositories
@flowerett
flowerett / gource.md
Last active July 3, 2018 11:15
Visualising repo commits with gource

basic usage

install gource and ffmpeg:

$ brew install gource
$ brew install ffmpeg

create a rawf ppm file, run inside your repo:

@flowerett
flowerett / Rancher.md
Created April 5, 2018 19:27 — forked from lmmendes/Rancher.md
Running Rancher locally (with two hosts) using MacOS Docker and VirtualBox

Rancher

Rancher is an open source project that provides a complete platform for operating Docker in production. It provides infrastructure services such as multi-host networking, global and local load balancing, and volume snapshots.

This documentation describes how to run Rancher localy for development and evaluation propuses.

I'm using Docker for OSX (native) but even for this to work you will need to install VirtualBox.

Launching Management Rancher Server

//1
for (var i = 0; i < 10; i++) {
setTimeout(function () {
console.log(i);
}, 0);
}
//2
var a = {
lol: 'xxx'
def dispatch(command, value = nil)
case command
when :create_parking_lot
@lot = create_parking_lot(value)
when :park
park(value)
when :leave
leave(value)
when :status
status
@flowerett
flowerett / q1.rb
Created May 16, 2017 09:19
Module
module C
def foo
"module C - instance method"
end
def foo
"module C - class method"
end
end
@flowerett
flowerett / Sidekiq Reset
Created February 16, 2017 09:48 — forked from unkleara/Sidekiq Reset
Sidekiq reset stats
To reset processed jobs:
Sidekiq.redis {|c| c.del('stat:processed') }
To reset failed jobs:
Sidekiq.redis {|c| c.del('stat:failed') }
To reset statistics:
Sidekiq::Stats.new.reset