This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import requests | |
import yaml | |
AWS_IP_RANGES_URL = "https://ip-ranges.amazonaws.com/ip-ranges.json" | |
def kubecost_direct_classification(kops_subnet): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: ./generate_release.sh v3.0.3 | |
USER= | |
TOKEN= | |
OWNER="$(basename $(dirname $(pwd)))" | |
PROJECT="$(basename $(pwd))" | |
NEW_RELEASE_TAG="$1" | |
CHANGELOG="CHANGELOG.tmp.md" | |
docker run -i --rm \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import urllib2 | |
librenms = json.loads( | |
urllib2.urlopen(urllib2.Request( | |
'https://librenms.hamwan.org/api/v0/devices', | |
headers={'X-Auth-Token': ''}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2.elb | |
def get_elbs_with_no_valid_instances(elb): | |
"""Finds ELBs with zero instances or where all instances are no longer in service.""" | |
for lb in elb.get_all_load_balancers(): | |
instances = lb.get_instance_health() | |
if len(instances) == 0: | |
yield lb | |
continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fileinput | |
print "".join(sorted(fileinput.input(), key=lambda fqdn: fqdn.lower().split('.')[::-1])), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from os.path import splitext | |
def db_to_norm(db): | |
return 10**(db/10.) | |
antfilename = sys.argv[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line | |
do | |
echo $line | |
if [[ $line == Writing* ]] | |
then | |
while IFS='"' read -ra writingline | |
do | |
filename=${writingline[1]%.*} | |
done <<< $line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PREVTABLE=/tmp/routes | |
NEWTABLE=$(mktemp) | |
ip r > "$NEWTABLE" | |
if [ -f "$PREVTABLE" ]; then | |
diff -u "$PREVTABLE" "$NEWTABLE" | |
fi | |
mv "$NEWTABLE" "$PREVTABLE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install HP management tools | |
hosts: hp | |
become: yes | |
tasks: | |
- name: Install pexpect for Ansible expect | |
apt: | |
name: python-pexpect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: twistd -ny telnet_auth.py | |
from twisted.conch.telnet import TelnetTransport, AuthenticatingTelnetProtocol | |
from twisted.internet.protocol import ServerFactory | |
from twisted.application.internet import TCPServer | |
from twisted.application.service import Application | |
log = open('creds.log', 'a') | |
class TelnetHoneypot(AuthenticatingTelnetProtocol): |
NewerOlder