Skip to content

Instantly share code, notes, and snippets.

View bradleyd's full-sized avatar
🏠
Working from home

Bradley D Smith bradleyd

🏠
Working from home
View GitHub Profile
@bradleyd
bradleyd / README.md
Created April 29, 2018 16:17 — forked from lukebakken/README.md
RabbitMQ / MQTT TCP Tuning

rabbitmq.config

[
    {rabbit, [
        {background_gc_enabled, true},
        {background_gc_target_interval, 60000},
        {tcp_listeners, [5672]},
        {num_tcp_acceptors, 10},
        {connection_max, infinity},
@bradleyd
bradleyd / tcp_flags.txt
Created February 22, 2018 22:50 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@bradleyd
bradleyd / test.cr
Created September 24, 2017 02:42
libc strtok
lib LibStrToken
fun strtok( input : LibC::Char*, delim : LibC::Char*) : LibC::Char*
end
module Test
class Run
def string_token(str, del)
LibStrToken.strtok(str, del)
end
@bradleyd
bradleyd / mix.lock
Created July 3, 2017 16:04
elixir parse mix.lock
%{"amqp": {:hex, :amqp, "0.2.0", "ec41c4327ca7c9b1ac0baabb824d47f77a14754bed89b69bb9d32041642d59a3", [:mix], [{:amqp_client, "~> 3.6.8", [hex: :amqp_client, optional: false]}, {:rabbit_common, "~> 3.6.8", [hex: :rabbit_common, optional: false]}]},
"amqp_client": {:hex, :amqp_client, "3.6.8", "0388e50af78285f370f0b346cd487c96dcf82c66f2196913073ee4d909808c89", [:make, :rebar3], [{:rabbit_common, "3.6.8", [hex: :rabbit_common, optional: false]}]},
"base16": {:hex, :base16, "1.0.0", "283644e2b21bd5915acb7178bed7851fb07c6e5749b8fad68a53c501092176d9", [:rebar3], []},
"binary_protocol": {:git, "[email protected]:Parkifi/binary_protocol.git", "f6d5afe7c7df4d48037680e17c1f824b90b705a9", []},
"certifi": {:hex, :certifi, "1.0.0", "1c787a85b1855ba354f0b8920392c19aa1d06b0ee1362f9141279620a5be2039", [:rebar3], []},
"distillery": {:hex, :distillery, "1.3.1", "211231af29ea55c79143d601a2caaf5936cc7b99e73bef25d78a0ff7f321b7fe", [:mix], []},
"eini": {:hex, :eini, "1.2.4", "abd64a0533398a6d714d21219bb85f2d41fdb42665ac40
@bradleyd
bradleyd / Gemfile.lock
Created July 3, 2017 01:56
software up to date
PATH
remote: .
specs:
et (1.1.0)
rest-client (~> 1.7)
sinatra (~> 1.4)
sinatra-contrib (~> 1.4)
GEM
remote: https://rubygems.org/
@bradleyd
bradleyd / gb_trees.ex
Created September 20, 2016 16:08
gb_trees
iex(15)> tree = :gb_trees.empty
{0, nil}
iex(16)> tree2 = :gb_trees.insert("/info", [%{remote: :"boo@localhost", counter: 1}], tree)
{1, {"/info", [%{counter: 1, remote: :boo@localhost}], nil, nil}}
iex(17)> tree3 = :gb_trees.update("/info", [:gb_trees.get("/info", tree2) |%{remote: :"bar@localhost", counter: 0}], tree2)
{1,
{"/info",
[[%{counter: 1, remote: :boo@localhost}] |
%{counter: 0, remote: :bar@localhost}], nil, nil}}
iex(18)> :gb_trees.get("/info", tree3) [[%{counter: 1, remote: :boo@localhost}] |
@bradleyd
bradleyd / date_util.erl
Created March 20, 2016 04:46 — forked from zaphar/date_util.erl
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
#!/usr/bin/env bash
# Small wrapper around the actual command used to start the daemon. This
# wrapper allows us to set various environment variables before Ruby is
# started.
#
# See the following URLs for more information on these options and their
# values:
#
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
defmodule SecureRandom do
@moduledoc """
Ruby-like SecureRandom module.
## Examples
iex> SecureRandom.base64
"xhTcitKZI8YiLGzUNLD+HQ=="
iex> SecureRandom.urlsafe_base64(4)
@bradleyd
bradleyd / message
Last active August 29, 2015 14:05
Pattern matching on many parameters
defmodule Message do
defstruct to: nil, subject: nil, text: nil, html: nil, from: nil, bcc: nil
# this is the minimum needed to send an email
def new(%{to: to, subject: subject, text: text, from: from}) do
{:ok, %Message{to: to, subject: subject, text: text, from: from} }
end
def new(%{to: to, subject: subject, html: html, from: from}) do
{:ok, %Message{to: to, subject: subject, html: html, from: from} }