Skip to content

Instantly share code, notes, and snippets.

nathan todd-stone nathants

Block or report user

Report or block nathants

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nathants
nathants / aws-rotate-access-key.py
Last active Jun 18, 2018
quickly rotate your aws access key
View aws-rotate-access-key.py
#!/usr/bin/env python3.6
import boto3
import os
import pprint
import sys
import termios
import tty
"""
View auto-restart.sh
#!/bin/bash
set -eou pipefail
# usage: auto-restart.sh python program.py
trap 'exit 1' SIGINT
count=$(ps -eo args | grep ^/bin/bash | grep "auto-restart $*"$ | grep -v grep | wc -l)
if (($count > 2)); then
echo already running: auto-restart $@ >&2
View rotate-logs.sh
#!/bin/bash
set -euo pipefail
# usage: myprogram.py | rotate-logs /tmp/myprogram.log [1000000]
file=$1
max_lines=${2:-1000000}
touch $file
line_count=$(cat $file | wc -l)
You can’t perform that action at this time.