Skip to content

Instantly share code, notes, and snippets.

View jwineinger's full-sized avatar

Jay Wineinger jwineinger

  • SPS Commerce
  • Minneapolis, MN
View GitHub Profile
@jwineinger
jwineinger / gist:db8504de26a9b033721d8e7b9fb9f126
Created October 21, 2020 16:53
Change GoLand PATH on macOS 10.14
1. "Show Package Contents" on the GoLand.app
2. Edit Contents/Info.plist
3. Add
<key>LSEnvironment</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin</string>
</dict>
4. Run `/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user`
@jwineinger
jwineinger / tasks-per-az.sh
Created July 26, 2018 20:37
Count ECS tasks per AZ for a service on a cluster
#!/bin/bash
#
# Ouptuts the number of tasks running per AZ for a given service on a given ECS cluster
#
#
# Boilerplate to setup a temp dir since we save some files for intermediate processing
#
set -e -o pipefail
@jwineinger
jwineinger / conftest.py
Created March 23, 2018 18:21
reorder pytest tests based on dependencies
def pytest_collection_modifyitems(session, config, items):
"""Reorder the execution of tests based on the dependency marks on tests.
To setup a test dependency, decorate the test function with the "depends"
mark and give a list of dependencies via the "on" keyword arg to the
decorator. Dependencies can be specified by name only when in the same
file as the test being decorated, or by pytest node path for tests in
other files/classes.
@pytest.mark.depends(on=["test_in_same_file",
@jwineinger
jwineinger / gist:68021d73189b70fca63a17c6d88c5669
Created November 17, 2017 05:10
syslog-ng sidecar to send log messages to AWS CloudWatch Logs
# syslog-ng.conf
@version: 3.12
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
owner("root"); group("adm"); perm(0640); stats_freq(0);
bad_hostname("^gconfd$");
};
source s_src {
network(
@jwineinger
jwineinger / gist:1c0406e690c7c9e7aa9912d25fadedee
Created February 6, 2017 21:09
Sort pictures based on EXIF datetime
exiftool '-Directory<DateTimeOriginal' -d %Y-%m-%d dir
@jwineinger
jwineinger / graph_gist_template.adoc
Created February 18, 2016 17:44 — forked from cheerfulstoic/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

TITLE OF YOUR GRAPHGIST

@jwineinger
jwineinger / picasa-web-2-facebook.py
Created October 2, 2014 06:33
Copy a picasa web album to a facebook album
import json
import requests
import gdata.photos.service
GOOGLE_ALBUM_ID = 0
GOOGLE_EMAIL = "you@gmail.com"
GOOGLE_PASSWORD = "hunter42"
FB_ACCESS_TOKEN = ""
@jwineinger
jwineinger / .bashrc
Last active August 29, 2015 14:06
bash config to speed up SSHing to EC2 nodes by name through a jumpbox. Also supports opening a set of similarly named servers in new tabs in OSX terminal.
# bashrc
. ~/.newtab.sh
tssh() { ssh `aws_name_to_ip $1` | sed -n "${2:-1}p"; }
aws_name_to_ip() {
if [ -z "$VIRTUAL_ENV" ]; then
workon aws;
fi
aws ec2 describe-instances --filters "Name=tag-value,Values=$1" --output text --query 'Reservations[*].Instances[*].PrivateIpAddress' | sort;
}
include:
- requirements
nodejs:
pkg.installed
statsd:
git.latest:
- name: https://github.com/etsy/statsd.git
- rev: v0.7.0
@jwineinger
jwineinger / media_mover.py
Created September 1, 2013 05:49
Just a script to move media files from one directory (recursively by default) into a different directory with date-based hierarchy. For JPG images, the EXIF data is read to determine the proper directory. If it cannot find the date via EXIF, then it falls back to the file's last modification time. It also uses the file's mtime for all other medi…
import os, argparse, hashlib
from datetime import datetime
from PIL import Image, ExifTags
from shutil import move
def modification_date(filename):
t = os.path.getmtime(filename)
return datetime.fromtimestamp(t)
def md5_for_file(f, block_size=2**20):