Skip to content

Instantly share code, notes, and snippets.

@arkan
arkan / safebuffer.go
Last active May 19, 2021 21:54
Golang: Buffer is a goroutine safe bytes.Buffer
package safebuffer
import (
"bytes"
"sync"
)
// Buffer is a goroutine safe bytes.Buffer
type Buffer struct {
buffer bytes.Buffer
@alext
alext / vpnc-script-aws
Last active July 12, 2018 12:54
vpnc script to route all AWS IP ranges over VPN.
#!/bin/bash
# vpnc-script wrapper for use with openconnect that routes all AWS IP ranges over the VPN.
# Pass any additional IP ranges to be routed as args to the script.
#
# Requirements: bash, curl and jq.
#
# Example usage:
# openconnect https://vpn.example.com/profile --script '/path/to/vpnc-script-aws'
#
@lazywithclass
lazywithclass / blog-post.md
Created February 20, 2017 02:25
Logging request body in HAProxy

Logging request body in HAProxy

On the 14th of October HAProxy 1.6 was released! Among all features announced I am particularly interested in the ability to log the body of a request.

It wasn't straightforward for me to understand how to do that, which is why I'm blogging it.

The relevant part could be found in the "Captures" section of the announcement, this is how I changed it to suit my needs:

# you need this so that HAProxy can access the request body
@webframp
webframp / windows.md
Created November 28, 2016 22:12
Minimum Viable Windows

A Mostly usable Windows workstation for macOS or Linux users

Especially starting with Windows 10, it isn't all that bad to work on day to day. It just requires a bit of setup out of the box to make it behave better just like those other platforms, and is sufficiently different so as to be non obvious to experienced Linux or macOS users.

Pick and choose what to do from below that fits your needs.

Note: I use emacs, like emacs keybindings and do a bit of Chef development,

@maplebed
maplebed / split_logstash.conf
Created November 1, 2016 03:35
Logstash config that sends sampled traffic to Honeycomb and all traffic to stdout
input { stdin { } }
filter {
grok {
match => ["message", "%{HAPROXYHTTP}"]
remove_field => ["message"]
}
mutate {
convert => { "actconn" => "integer"
"backend_queue" => "integer"
"beconn" => "integer"
@maxvt
maxvt / infra-secret-management-overview.md
Last active February 28, 2024 20:53
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@oli-logicnow
oli-logicnow / gist:da1be4c9dccadb94670338e21bf4f348
Last active March 15, 2018 15:07
Find all the keys and their associated user for a specific account
export PROFILE=XXXX
for USER in `aws --profile $PROFILE iam list-users --query 'Users[].UserName' --output text`
do
for KEY in `aws --profile $PROFILE iam list-access-keys --user-name "$USER" --query 'AccessKeyMetadata[].AccessKeyId' --output text`
do
echo $USER $KEY
done
done
@lusis
lusis / index.md
Last active July 13, 2019 13:16
Docker "Best Practices"

This is a copy/paste from an internal wiki on how we should use docker

This guide is to serve as an outline of internal best practices to using Docker. The idea is to give enough information to allow engineers to create containers for new stack components while minimizing the cleanup required to make them production ready.

Concepts

Before we get to the practices, it's important to understand WHY we are doing this. The key concepts we're concerned about with broad Docker usage are provenance, determinism, repeatability and auditability.

Provenance

Provenance refers to knowing WHERE something comes from. Generally with the end use of software, this is easy:

  • Maven artifacts are pulled from central
anonymous
anonymous / IRC client in pure bash 4
Created March 28, 2016 16:57
IRC client written in pure bash using only bash builtin commands and no other binaries.
#!/bin/bash
#no PATH, no way to accidently run any programs
PATH=''
#useful variables
term_height=0
term_width=0
term_scroll_height=0
status_line_row=0
@alirobe
alirobe / reclaimWindows10.ps1
Last active May 27, 2024 21:14
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###