Skip to content

Instantly share code, notes, and snippets.

View Ropes's full-sized avatar

Josh Roppo Ropes

View GitHub Profile
@Ropes
Ropes / beancount.py
Last active December 22, 2015 19:29
Bohnanza max score calculation. If I understand the game rules correctly, I think I've fixed the mistakes.
from __future__ import print_function, unicode_literals
bean_types = {
'coffee': (24, [4, 7, 10, 12]),
'wax': (22, [4, 7, 9, 11]),
'blue': (20, [4, 6, 8, 10]),
'chili': (18, [3, 6, 8, 9]),
'stink': (16, [3, 5, 7, 8]),
'green': (14, [3, 5, 6, 7]),
'soy': (12, [2, 4, 6, 7]),
@Ropes
Ropes / palindrome.py
Created May 9, 2014 20:38
Palindrome Check
from __future__ import print_function, unicode_literals
def iter_palindrome(string):
'''Memory efficient but unelegant iterative solution.
Starting at each end of the string comapre characters until the center
is reached or iterators overlap if it's semetric
'''
print(string)
i = 0
j = len(string) - 1
@Ropes
Ropes / gist:6a3f317adf0d65b3cd60
Last active August 29, 2015 14:11
Music TODO
Woods-With Light and Love
CONOR OBERST ‘Hundreds of Ways’
ALVVAYS ‘Archie, Marry Me’
PORTER ROBINSON FEAT. AMY MILLAN ‘Divinity’
THE 2 BEARS ‘Not This Time’
SON LITTLE ‘The River’
FATHER JOHN MISTY ‘Bored In The USA’ et other music
TY SEGALL ‘Feel’
ADIA VICTORIA ‘Stuck in the South’
STRAND OF OAKS ‘JM’
@Ropes
Ropes / gist:96504aa424a969097fe9
Last active August 29, 2015 14:24
TCP Dump Magic

Show all packet contents traversing a port
tcpdump -s 0 -A 'tcp port 9200'

Show packets with a destination on a port
tcpdump -s 0 -A 'tcp dst port 9200

Voodoo to show the HTTP Header of packets destined for a port
tcpdump -s 0 -A 'tcp dst port 9200 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)'

@Ropes
Ropes / DevOps_Dialogue.md
Last active January 2, 2017 18:44
OpsDoc Service Dialogue Template

This document exists to provide a template for documenting operational information about a service. The goal is to cover all of the bases so a reader can get a general understanding of the service and how to operate it.

The topics listed are a minimal starting point for documenting a service. Some won't be relevant, if so state why. Almost certainly some issues have been missed should be added to the template as they're discovered(<3 PRs).

#DevOps Dialogue Service Template

@Ropes
Ropes / hihi copy pasta.md
Created January 3, 2017 21:33
Copy small blobs of files from one terminal to another.

Compress and tarball files, and pipe the output into base64 which will get dumped to your terminal.

tar -czf - ./filesyouwant* | base64

Copy only the base64 output characters into your host's clipboard.

@Ropes
Ropes / gke.md
Last active July 20, 2017 18:25
Summations of Standard GCP VM CPUs

Sum the number of cores of running VMs in GKE

gcil | grep standard | grep RUNNING | awk '{print $3}' | cut -d'-' -f3 | paste -s -d+ | bc

Add tags to all VMs of an instance Group

gcloud compute instance-groups list-instances <GKE INSTANCE GROUP NAME> --format=json | jq .[].instance | cut -c93- | tr -d "\"" | xargs -d " " gcloud compute instances add-tags --tags=$TAG
@Ropes
Ropes / bashrc.sh
Created April 17, 2017 17:20
Kubernetes kubectl Aliases
alias ktl='kubectl'
alias kpd='kubectl get pods'
alias kwatch='kubectl get events --watch'
alias kcgc='kubectl config get-contexts'
alias kcsg='kubectl config set-context'
@Ropes
Ropes / top100.csv
Created May 6, 2017 01:19
NA mountains
Denali 20 320 20 156 AK Alaska Range
Mt Logan 19 541 17 215 YT St Elias Mountains
Pico de Orizaba 18 491 16 148 PU Cordillera Neovolcanica
Mt St Elias 18 008 11 184 AK/YT St Elias Mountains
Volcan Popocatepetl 17 717 9 909 MR Cordillera Neovolcanica
Mt Foraker 17 400 7 200 AK Alaska Range
Mt Lucania 17 192 9 974 YT St Elias Mountains
Volcan Iztaccihuatl 17 126 5 053 EM Cordillera Neovolcanica
King Peak 16 972 3 455 YT St Elias Mountains
Mt Bona 16 500 6 800 AK St Elias Mountains
@Ropes
Ropes / kubectl.md
Last active August 11, 2017 00:27
Kubernetes Toolbelt

List CPU/Memory capacity of nodes

kubectl describe nodes | grep -A 2 -e "^\\s*CPU Requests"

kubectl describe nodes | egrep -A 2 "(^\\s*CPU Requests)|(^Name)"

List all Pods keyed by their host Node: