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
View retry.sh
#!/bin/bash
# define the retry fn
retry() {
e=0
if [[ $- =~ e ]]; then
e=1
fi
set +e
max_tries=10
View keybase.md

Keybase proof

I hereby claim:

  • I am nathants on github.
  • I am nathants (https://keybase.io/nathants) on keybase.
  • I have a public key ASBvsxkJ-Tl1HIlxes6dJ3bGDfOqAhC_HBJXGuglMvDnOgo

To claim this, I am signing this object:

View new-password.py
#!/usr/bin/env python3.6
import secrets
import string
import sys
import tty
import termios
import functools
import math
import operator
@nathants
nathants / pip-upgrade.py
Created Jun 18, 2018
check for updates and optionally upgrade packages via pip
View pip-upgrade.py
#!/usr/bin/env python3
"""
check for updates and optionally upgrade packages via pip
"""
import os
import subprocess
import sys
import termios
View die-hard.py
from hypothesis import given, settings
from hypothesis.strategies import lists, sampled_from
def new_state():
return {'big': 0, 'small': 0}
def desired_state(state):
return state['big'] != 4
def empty_big(state):
View log-watcher.py
#!/usr/bin/env python3
import functools
import sys
import time
import collections
import threading
import queue
email_to = '_@_.com'
email_subject = 'error'
View s3-du.py
"""
prints a table of the largest prefixes in an s3 bucket, along with some meta-data.
usage:
$ python3.4 s3_du.py -h
usage:
$ aws s3 ls $BUCKET --recursive | python3.4 s3_du.py | head -n 100 | columnt -t
example:
View pg-util.py
#!/usr/bin/env python2.7
"""
chunked backup and restore utilities for postgres via s3 with
minimal local disk/ram requirements.
dependencies:
- pip install argh awscli
- have awscli creds configured
"""
View license.txt
All public gists https://gist.github.com/nathants
Copyright 2012-present, Nathan Todd-Stone
MIT License, http://www.opensource.org/licenses/mit
@nathants
nathants / monitor-usage.py
Last active Jun 18, 2018
simple server usage monitoring, writing json to stdout. depends on psutil and python3.4, but should work with any python version with minor modifications.
View monitor-usage.py
#!/usr/bin/env python3.4
"""
simple server usage monitoring, writing json to stdout. depends on
psutil and python3.4, but should work with any python version with
minor modifications.
to add usage to your log: $ nohup python3.4 usage.py 3 >> /var/log/your_normal_app_log.log &
You can’t perform that action at this time.