Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am MrSaints on github.
  • I am mrsaints (https://keybase.io/mrsaints) on keybase.
  • I have a public key whose fingerprint is 23EB 5004 75C1 2A47 6D3E FE59 E45D 4BB2 8169 BA4F

To claim this, I am signing this object:

@MrSaints
MrSaints / priority_tree.go
Created July 14, 2017 21:32
A radix trie inspired structure with priority queues.
package converter
import (
"container/heap"
"mime"
"strings"
)
type ConverterPriorityQueueItem struct {
converter Converter
@MrSaints
MrSaints / main.go
Created May 25, 2017 16:15
Coffee shop concurrency. Examining concurrency in the real world by scaling a coffee shop's efficiency.
package main
import (
"fmt"
"github.com/icrowley/fake"
"math/rand"
"time"
)
const (
@MrSaints
MrSaints / go-qthtml2pdf.go
Last active January 6, 2020 22:30
A basic HTML to PDF converter in Golang using Qt WebEngine 5.7. For a more production-ready converter, see: http://www.athenapdf.com/
package main
import (
"flag"
"fmt"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/webengine"
"github.com/therecipe/qt/widgets"
"os"
go build -ldflags "-X http://main.build =$(git rev-parse --short HEAD)"
https://github.com/kovetskiy/go-fast
@MrSaints
MrSaints / command.go
Last active June 26, 2017 10:06
A wrapper around `exec.Command(...).Output()` to execute external commands / binaries with support for cancellation signals via channels (i.e. terminate the running process).
package main
import (
"errors"
"log"
"os/exec"
)
var (
ErrCmdCancelled = errors.New("command cancelled")
@MrSaints
MrSaints / Docker Notes.txt
Last active May 16, 2017 11:11
Notes on initiating a Docker Machine; killing Docker processes; cleaning Docker containers, and images; and building / running / executing with Docker. Docker, Docker, Docker...
# You probably don't need this one with the new Docker for MacOS #
docker-start() {
docker-machine start ${1:-dev}
eval "$(docker-machine env ${1:-dev})"
export DOCKER_IP=$(docker-machine ip ${1:-dev})
echo The machine ip is DOCKER_IP=$DOCKER_IP
}
# These clean up commands are no longer necessary with `docker system prune`
@MrSaints
MrSaints / WeeChat Notes.txt
Last active April 3, 2017 17:04
Notes on setting up, and joining a new IRC server on WeeChat using a SOCKS5 proxy.
/server add <name> <server>/<port>
/proxy add <proxy-slug> socks5 <proxy-host> <proxy-port> <proxy-user> <proxy-pass>
/set irc.server.<server-slug>.username <username>
/set irc.server.<server-slug>.realname <real-name>
/set irc.server.<server-slug>.nicks <nick1>, <nick2>, <nick3>
/set irc.server.<server-slug>.ssl on
/set irc.server.<server-slug>.ssl_verify off
@MrSaints
MrSaints / triangle.exs
Created July 1, 2015 19:49
Pascal's triangle in Elixir (using recursion where possible).
# Author: MrSaints
# License: MIT
defmodule Factorial do
def recursive(n, acc) when n === 1 or n === 0 do
acc
end
def recursive(n, acc) do
temp = n - 1
@MrSaints
MrSaints / Package Control.sublime-settings
Last active August 29, 2015 14:10
Sublime Text Editor Backup
{
"installed_packages":
[
"AutoFileName",
"Base16 Color Schemes",
"Better CoffeeScript",
"Elixir",
"Emmet",
"GoSublime",
"Gutter Color",