Skip to content

Instantly share code, notes, and snippets.

View elliot's full-sized avatar

Elliot Anderson elliot

View GitHub Profile
1. Suspend: Ctrl+z
2. Resume: bg
3. Disown: disown %1
4. Launch screen
5. Find pid: prep BLAH
6. Reparent process: reptyr ###
@elliot
elliot / launch.sh
Created December 4, 2017 06:53
Docker + Java Heap Optimisation
# >= Java 8 Update 131
# UseCGroupMemoryLimitForHeap - discover limits via cgroups
# MaxRAMFraction - use it all
java -server -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1

Keybase proof

I hereby claim:

  • I am elliot on github.
  • I am elliotanderson (https://keybase.io/elliotanderson) on keybase.
  • I have a public key whose fingerprint is 6762 80CB 263C 1F4A B71B B01D 0F2D 4C22 5CB0 FC38

To claim this, I am signing this object:

@elliot
elliot / foo.tf
Created September 26, 2017 02:17
Medium Test
provider "aws" {
# ...
assume_role {
role_arn = "arn:aws:iam::[INT]:role/[ROLE]"
}
}
@elliot
elliot / tcpdump.sh
Created September 20, 2017 01:25
TCP One Liners
# Monitor DNS queries
sudo tcpdump -i en0 -s 5000 -n port 53
-- These queries have been tested on a Postgres 9.5 Cluster running on RDS
-- Show queries running longer than 2 minutes
SELECT now() - query_start as "runtime", usename, datname, waiting, state, query
FROM pg_stat_activity
WHERE now() - query_start > '2 minutes'::interval
ORDER BY runtime DESC;
--
SET application_name='%elliot%';
sudo tcpdump -A -s 10240 'tcp port 10009 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' | egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " | sed -r 's/^........(GET |HTTP\/|POST |HEAD )/\n\1/g'
docker ps --filter 'label=app.command=admin' --format '{{ .ID }} {{ .RunningFor }}' | grep day | awk '{print $1}' | xargs -r docker kill
#!/bin/bash
while [[ true ]]; do
SECONDS=$(mysql --defaults-file=/home/elliot/.my.cnf -h $HOST -u $USER -e 'show slave status\G'| grep Seconds_Behind_Master | awk '{print $2}')
echo $((SECONDS/86400))" days"\
$(date -d "1970-01-01 + $SECONDS seconds" "+%H hours %M minutes %S seconds")
sleep 10
done
@elliot
elliot / elb-ciphers.py
Created June 9, 2016 04:27
ELB Cipher Suite Configuration
#!/usr/bin/env python
# Apply recommendation from https://wiki.mozilla.org/Security/Server_Side_TLS
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contributors:
# Gene Wood [:gene]