Skip to content

Instantly share code, notes, and snippets.

@m-radzikowski
m-radzikowski / script-template.sh
Last active April 8, 2024 03:04
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@carolynvs
carolynvs / .gitconfig
Last active October 19, 2022 14:44
git wip - Show what branches you have been working on lately
[alias]
wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads
@imduffy15
imduffy15 / policy.json
Created September 13, 2016 18:01
Packer AWS IAM policy
{
"Statement": [
{
"Action": [
"ec2:Describe*",
"ec2:CreateKeyPair",
"ec2:DeleteKeyPair",
"ec2:CreateImage",
"ec2:DescribeKeyPairs",
"ec2:CreateSecurityGroup",
@Adron
Adron / install-terraform-packer-os-x.sh
Last active June 22, 2021 20:28
Install Terraform & Packer on Linux
#!/usr/bin/env bash
# Script prerequisite > install jq > https://stedolan.github.io
# ********************************************************************************************
# UPDATE: Check out Robert's repo here https://github.com/robertpeteuil/terraform-installer
# Robert's repo is more built out and has more options around the installation process.
# Cheers! -Adron
# ********************************************************************************************
cd ~
@hassy
hassy / parse_aws.md
Last active January 17, 2024 04:11
Deploying Parse Server on AWS (WIP)

Deploying Parse Server on AWS

Note: this is a work-in-progress and will be updated with more information over the next few days.

Intro

This guide will walk you through deploying your own instance of the open-source Parse Server. This would be a good starting point for testing your existing application to see if the functionality provided by the server is enough for your application, and to potentially plan your migration off the Parse Platform.

This guide will walk you through using Elastic Beanstalk (EB), which is an AWS service similar to Heroku. Why use EB rather than Heroku? Elastic Beanstalk does not lock you into Heroku-specific ways of doing things, is likely cheaper to run your backend on than Heroku, and it integrates with other services that AWS offer (and they offer almost everything one needs to run an application these days).

#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")
@ericlagergren
ericlagergren / index.gohtml
Last active December 22, 2023 17:51
Hot-reloading / hot-swapping live template files in Go
My name is {{.Name}} and I'm {{.Age}} years old!!
@mbainter
mbainter / aws_config.fish
Last active February 24, 2024 15:51
Fish shell function to set your AWS credentials with MFA for use with Terraform
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set -e AWS_ACCESS_KEY
set -e AWS_SECRET_KEY
set -g -x ATLAS_TOKEN (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"atlas_token\") { print \$3 }}" ~/.aws/credentials)
set account (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"account_id\") { print \$3 }}" ~/.aws/credentials)
set username (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"username\") { print \$3 }}" ~/.aws/credentials)
set mfarn "arn:aws:iam::$account:mfa/$username"
@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@ruslangabitov
ruslangabitov / go-tls-renegotiation patch
Created December 1, 2014 23:41
go-tls-renegotiation patch
diff -r c242bbf5fa8c src/pkg/crypto/tls/common.go
--- a/src/pkg/crypto/tls/common.go Wed Jul 17 14:03:27 2013 -0400
+++ b/src/pkg/crypto/tls/common.go Thu Jul 18 13:45:43 2013 -0400
@@ -44,6 +44,7 @@
// TLS handshake message types.
const (
+ typeHelloRequest uint8 = 0
typeClientHello uint8 = 1
typeServerHello uint8 = 2