Skip to content

Instantly share code, notes, and snippets.


Nikolai Zujev jaymecd

View GitHub Profile
mholt / macapp.go
Created May 18, 2018
Distribute your Go program (or any single binary) as a native macOS application
View macapp.go
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
// Example use:
View .bash_profile
# auto mfa
complete -W "$(ls -1 ~/.aws/*.mfa | awk -F "/" '{print $5}' | sed -e 's/\.mfa$//')" mfa
function mfa () {
oathtool --base32 --totp "$(cat ~/.aws/$1.mfa)" | pbcopy ;
# manual mfa
function mmfa () {
oathtool --base32 --totp "$1" ;
mvanholsteijn / copy-ssm-parameters
Created Feb 14, 2018
script to copy all SSM parameter store parameters to disk
View copy-ssm-parameters
#!/usr/bin/env python
# copy all SSM parameter store parameters to disk
import os, sys, argparse, boto3
parser = argparse.ArgumentParser(description='copy all parameter values to local')
parser.add_argument("--path", dest="path", required=True,
help="to copy the keys from", metavar="STRING")
parser.add_argument("--directory", dest="directory", required=True,
shortjared / list.txt
Last active Oct 23, 2020
List of AWS Service Principals
View list.txt
pgolding /
Last active Jul 7, 2020
Passing AWS Lambda Function parameters using the ClientContext object in Python

Boto3 documentation for lambda_client.invoke suggests it is possible to pass data via the ClientContext object as a string.

The string is required to be base64 encoded JSON.

To encode such a string, use:

import baseb4
Neo23x0 / audit.rules
Last active Oct 26, 2020
Linux Auditd Best Practice Configuration
View audit.rules
# This gist has been transformed into a github repo
# You can find the most recent version there:
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
pteich / main.go
Last active Sep 17, 2020
Example for using go's sync.errgroup together with signal detection signal.Notify to stop all running goroutines
View main.go
package main
import (
jaymecd / brew-go-get
Created Aug 27, 2017
OSX brew-like GO apps install
View brew-go-get
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: brew-go-get ..."
exit 1
NAME=$(basename "${1}")
mariocj89 /
Last active Sep 10, 2020
Understanding logging in Python

Logging trees


When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.

letmaik /
Last active May 10, 2019
Using travis_retry inside shell scripts together with set -e

If you want to use travis_retry from within your own shell script files then you first have to make the travis_retry shell function available by sourcing the file, otherwise you just get a "command not found" error. See for a full example.

Note that the original function as found in the travis-ci/travis-build repository was slightly modified to allow it to be used in a shell context where set -e is enabled.

For reference, a tweet by Travis CI saying that you should copy the travis_retry code as I've done here:

You can’t perform that action at this time.