Skip to content

Instantly share code, notes, and snippets.

View leetrout's full-sized avatar
🎸

Lee Trout leetrout

🎸
View GitHub Profile
@leetrout
leetrout / .inputrc
Created March 20, 2020 00:52
arrow key partial completion in shells, irb, etc
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
@leetrout
leetrout / pitch.md
Created February 29, 2020 15:41
GoCon Canada

Elevator Pitch (300 chars)

How many requests per second does your application serve? Are you sure? This talk covers the basics of load testing Go applications with off the shelf tools. You will leave with practical knowledge to test your own applications. Stop lying about performance.

Description

Stop lying about the performance of your application! Learn about load testing. When working at a prior startup a customer asked if we could handle 10,000 to 20,000 requests per second. Could we? Sure. Maybe. Well, probably.

It turns out we could handle about 180 requests per second. The customer was OK with caching results to reach their goal but our Go application bottlenecked our progress. Before we made any changes we measured. And once we identified potential solutions we could benchmark as we made changes. We could confirm what did and did not work.

@leetrout
leetrout / docker-compose.yml
Created February 6, 2020 03:25
Reddit Syncthing
version: "3"
services:
nginx:
image: nginx:latest
container_name: nginx-0
networks:
- web
ports:
- "8000:80"
@leetrout
leetrout / example.sh
Created December 27, 2019 22:37
bash script directory
# https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@leetrout
leetrout / comp_behavior.py
Created October 25, 2019 16:19
Python Comprehensions Behavior
things = {
"foo": "bar",
"baz": "bing",
}
for k, v in things.items():
pass
print("k leaked: " + k)
@leetrout
leetrout / README.md
Created August 23, 2019 21:45
Emulating a RasPi Utilizing QEMU
@leetrout
leetrout / deploy.sh
Created July 8, 2019 17:31
Quick deploy hack
#!/bin/bash
# Simple deploy script to pull updated images
IMAGE=your_image_repo
docker pull $(docker images -f=reference='*/${IMAGE}' --format="{{.Repository}}:{{.Tag}}")
# If using compose
#/usr/local/bin/docker-compose -f /path/to/compose.yml down
#/usr/local/bin/docker-compose -f /path/to/compose.yml up -d
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@leetrout
leetrout / redirectExample.go
Last active April 29, 2019 21:04 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
// From https://gist.github.com/d-schmidt/587ceec34ce1334a5e60
package main
import (
"log"
"net/http"
"net/url"
"os"
"strings"
)