Skip to content

Instantly share code, notes, and snippets.

@bryanhuntesl
bryanhuntesl / 2019-https-localhost.md
Created December 6, 2019 17:21 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@bryanhuntesl
bryanhuntesl / CRDT.md
Created October 31, 2019 14:54 — forked from joeljacobson/CRDT.md
CRDT Examples

Bucket Types

Bucket types were added in 2.0 to eliminate the need for each bucket to have it's own custom bucket properties. If buckets share the same custom bucket properies, a bucket type can be created for them.

Creating Bucket Types

To get started, you'll want to create a new bucket type with:

riak-admin bucket-type create  
version: "3"
services:
db:
image: "postgres"
container_name: "postgres_db"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=db
ports:
@bryanhuntesl
bryanhuntesl / advanced.config
Created October 21, 2019 16:12 — forked from thirdreplicator/advanced.config
An example Riak advanced.config file adding the delete_mode parameter set to "immediate". On Ubuntu, this file is located here: /etc/riak/advanced.config
%% Config file used to set advanced configuration options
[
{riak_kv, [
{delete_mode, immediate}
]},
{lager,
[
{extra_sinks,
[
@bryanhuntesl
bryanhuntesl / diff.ex
Created March 25, 2019 14:19 — forked from tony612/diff.ex
elixir diff(extracted from ExUnit code)
defmodule Diff do
def diff(left, right, %{diff_type: :cli} = config) do
# %{enabled: true}
Diff.Cli.diff(left, right, config)
end
def format_sides(left, right, formatter) do
case format_diff(left, right, formatter) do
{left, right} ->
{IO.iodata_to_binary(left), IO.iodata_to_binary(right)}
@bryanhuntesl
bryanhuntesl / example.puml
Created September 27, 2018 11:30 — forked from QuantumGhost/example.puml
A simple template for PlantUML to draw ER diagram. The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
defmodule DockerApi do
@version "v1.37"
@endpoint URI.encode_www_form("/var/run/docker.sock")
@protocol "http+unix"
def commit(container_id, payload) do
# commit image
{:ok, %{body: body}} =
HTTPoison.post(
"#{@protocol}://#{@endpoint}/#{@version}/commit?container=#{container_id}",
@bryanhuntesl
bryanhuntesl / readme.md
Created August 2, 2018 09:46 — forked from flbuddymooreiv/readme.md
erlang + rebar + cowboy Hello World

This is the process of setting up erlang, rebar3, and cowboy for a Hello World, starting with a clean Debian 8 install.

Update apt and install deps:

root@046edcaea45a:~# apt-get update
root@046edcaea45a:~# apt-get install erlang erlang-dev gcc
root@046edcaea45a:~# wget https://s3.amazonaws.com/rebar3/rebar3
root@046edcaea45a:~# mkdir ~/bin/
root@046edcaea45a:~# mv rebar3 ~/bin/
root@046edcaea45a:~# chmod +x ~/bin/rebar3 
@bryanhuntesl
bryanhuntesl / README.md
Created July 17, 2018 09:55 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
@bryanhuntesl
bryanhuntesl / gist:1d3ff6d7158b392bf31dbee84f4afbe8
Created July 13, 2018 09:39 — forked from sdebnath/gist:36c235e042cb35db7d1f
Add field to Riak YZ Schema with CRDTs
This gist captures what needs to be done to add a new field to Riak's Yokozuna
search index.
Sources:
- https://github.com/basho/yokozuna/issues/130
- http://riak-users.197444.n3.nabble.com/How-to-update-existed-schema-td4032143.html
The code below is for illustration purposes only. Use at your own risk.
1. Create/Update new schema file