Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikolai Zujev jaymecd

View GitHub Profile
@mholt
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:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// 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
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
shortjared / list.txt
Last active Oct 23, 2020
List of AWS Service Principals
View list.txt
a4b.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
apigateway.amazonaws.com
application-autoscaling.amazonaws.com
appstream.application-autoscaling.amazonaws.com
appsync.amazonaws.com
@pgolding
pgolding / example.md
Last active Jul 7, 2020
Passing AWS Lambda Function parameters using the ClientContext object in Python
View example.md

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
base64.b64encode(b'<string>').decode('utf-8')
@Neo23x0
Neo23x0 / audit.rules
Last active Oct 26, 2020
Linux Auditd Best Practice Configuration
View audit.rules
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
@pteich
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 (
"context"
"errors"
"fmt"
"os"
"os/signal"
"syscall"
"time"
@jaymecd
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 github.com/foo/bar ..."
exit 1
fi
NAME=$(basename "${1}")
@mariocj89
mariocj89 / python-logging.md
Last active Sep 10, 2020
Understanding logging in Python
View python-logging.md

Logging trees

Introduction

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
letmaik / README.md
Last active May 10, 2019
Using travis_retry inside shell scripts together with set -e
View README.md

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 travis_retry.sh file, otherwise you just get a "command not found" error. See example.sh 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: https://twitter.com/plexus/status/499194992632811520

You can’t perform that action at this time.