Skip to content

Instantly share code, notes, and snippets.

@lucjross
lucjross / .tf
Last active May 20, 2020 02:54
ALB Listener Rule, weighted Target Groups
resource "aws_alb_listener_rule" "http_80" {
count = local.lb ? 1 : 0
listener_arn = data.aws_alb_listener.http_80.arn
action {
type = "forward"
target_group_arn = aws_alb_target_group.http_80[0].arn
}
condition {
host_header {
values = [local.host_name]
@dragon788
dragon788 / cheap_windows_dev.md
Last active November 23, 2019 04:11
"Quickly" getting a Windows VM setup for dev and testing using free tools and evaulation licenses

Modern.ie is behind the times, Microsoft/EdgeOnWindows on the VagrantUp box site is WAY out of date, what's a guy to do? Build your own!

Now to build these you'll need Packer and the virtualization tool you are building the box for, Virtualbox or VMware Workstation (or Parallels on Mac). Packer is written in Go and doesn't really require any external dependencies. If you are on Linux you can possibly find Packer in your package management tool, but it is best to grab the latest binary from https://packer.io and extract it to /usr/local/bin/ as packer or put it in ~/.local/bin/ if you have that in your PATH variable. On macOS use Homebrew from https://brew.sh to install with brew install packer. On W

curl -L https://releases.hashicorp.com/packer/1.4.5/packer_1.4.5_linux_amd64.zip -o ~/Downloads/packer.zip
unzip packer.zip
sudo install -m 755 packer /usr/local/bin/ # Allows any user to run it
sudo apt install virtualbox # or grab it from the https://virtualbox.org website

Go

@crisidev
crisidev / access.lua
Created May 14, 2018 14:47 — forked from mariocesar/access.lua
Nginx Lua script redis based for Basic user authentication
function password_encode(password)
local bcrypt = require 'bcrypt'
return bcrypt.digest(password, 12)
end
function check_password(password, encoded_password)
local bcrypt = require 'bcrypt'
return bcrypt.verify(password, encoded_password)
end
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@wlgrd
wlgrd / Betaflight for ubuntu
Last active January 27, 2024 22:23
How to set up betaflight fc with Ubuntu
1. Create a rule for the DFU
$ (echo '# DFU (Internal bootloader for STM32 MCUs)' echo 'ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/45-stdfu-permissions.rules > /dev/null
2. Monitor connection and find your model (unplug/plug the fc while this cmd is active)
$ udevadm monitor --environment --udev | grep ID_MODEL_ID
3. Update the /etc/udev/rules.d/45-stdfu-permissions.rules file with your model. E.g, my MODEL_ID is 5740, and the .rules file
ends up like this:
@bussiere
bussiere / compress.go
Created December 22, 2016 01:16
compress uncompress a string in golang
package main
import (
"bytes"
"compress/gzip"
"fmt"
"encoding/base64"
"io/ioutil"
)
@klm1
klm1 / README.markdown
Last active July 27, 2017 21:36 — forked from larrycai/README.markdown
check the plugin usage in jenkins
@garthk
garthk / profile
Created June 21, 2015 23:51
boot2docker 1.7.0 cert fix
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
@VladSem
VladSem / tmux_ubuntu14.04.sh
Last active July 7, 2020 21:12
install tmux 2.0 on Ubuntu 14.04
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux=2.0-1~ppa1~t
@philwinder
philwinder / authorize.lua
Last active February 3, 2022 07:36
IVZ: Nginx config for using Lua as the authentication module. You must install nginx with lua support. See "openresty" for linux distros or the vagrant bootstrap shell script.
--[[
Provides custom authorization for nginx.
See the `nginx_authorize_by_lua.conf` for the Nginx config. This lua file is referenced in the config
See testWebserverAccess.sh for unit tests.
To Run nginx (make sure you have the lua, config and htpasswd file):
$ /usr/local/openresty/nginx/sbin/nginx -c /etc/nginx/conf/nginx_authorize_by_lua.conf
Logs are available at: /usr/local/openresty/nginx/logs/lua.log
To write to the log: