Skip to content

Instantly share code, notes, and snippets.

View srevenant's full-sized avatar

Brandon Gillespie srevenant

  • Utah
View GitHub Profile
@srevenant
srevenant / fprof-report.exs
Created September 19, 2022 21:47
Elixir Human Readable reporter for erlang's :fprof output
defmodule FPR do
@moduledoc """
# FProf Reporter
Format results from `:fprof` into something human readable, with some basic
filtering and sorting options.
Start/Stop `:fprof` from IEx with the calls shown below (connect to your
running application idealy).
'use strict'
const DOMAIN = 'a.roguetrader.com'
const AUTHX_BASE = '/authx/v1/api'
const VALIDATION = {} // copy validation from your profile->APIKey page
const request = require('request')
const jwt = require('jsonwebtoken')
const uuid = require('uuid')
/* ********************************************************************** */
@srevenant
srevenant / time.ex
Last active October 10, 2019 19:41
Time bits for use in Elixir. Sometime, it's easier to just fall back to posix time... LMK if you find better ways to do this!
defmodule Utils.Time do
import Utils.Types, only: [str_to_int!: 1, str_to_float: 1]
import Utils.Enum, only: [enum_rx: 2]
# note for future
# https://hexdocs.pm/nimble_parsec/NimbleParsec.html
def iso_time_range(input) when is_binary(input) do
case String.split(input, "/") do
[stime, etime] ->
@srevenant
srevenant / kubectl aliases for bashrc
Created October 17, 2018 18:39
kubectl aliases for bashrc
kube-env() {
local env=$1
local ns=${2:-apz}
[ ! $env ] && {
echo "KUBE_ENV =$KUBE_ENV"
echo "KUBE_NAMESPACE=$KUBE_NAMESPACE"
echo "Envs: p1 d1"
echo "Namespaces: (run kubectl get namespaces)"
return 0
/* bring in configs, and backends, like db */
/* const config = require('config') */
let healthy = true
setInterval(() => {
// check db pools, maybe run a query, etc.
try {
if (db.check_health()) { // but do this with a timelimit that is less than check interval seconds
healthy = true
@srevenant
srevenant / .bashrc
Last active September 7, 2018 18:36
fast-forward git bash helpers
# When working on a project with multiple developers master will get ahead of your work.
# To come in sync should you rebase? merge? what is a fast-forward? Lots of discussion
# is available on this, here are a few:
# https://hackernoon.com/git-merge-vs-rebase-whats-the-diff-76413c117333
# https://www.atlassian.com/git/tutorials/merging-vs-rebasing
#
# I prefer a merge/fast-forward, rather than rebase. These helpers assist in that process.
# LMK your thoughts and if you know of a better way! Enjoy!