Skip to content

Instantly share code, notes, and snippets.

View coxley's full-sized avatar

Codey Oxley coxley

View GitHub Profile

Keybase proof

I hereby claim:

  • I am coxley on github.
  • I am codey (https://keybase.io/codey) on keybase.
  • I have a public key ASAdPlQ6Amw-Cm_WrqBP9Qoe15zwQanYo__bBTTwlMAMHQo

To claim this, I am signing this object:

@coxley
coxley / dyndnsd.conf
Created December 11, 2015 21:45
Upstart init for cmur2/dyndnsd
description "dyndnsd"
author "[email protected]"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 15 5
exec /usr/local/bin/dyndnsd /opt/dyndnsd/config.yaml
# vim: set ft=upstart:
@coxley
coxley / pre-commit
Created December 9, 2015 08:20 — forked from anl/pre-commit
Git pre-commit hook for DNS zone data - see http://andyleonard.com/2012/01/21/git-pre-commit-hook-for-dns-zone-data/
#!/bin/bash
# Adapted from a puppet pre-commit hook at:
# http://blog.snijders-it.nl/2011/12/example-puppet-27-git-pre-commit-script.html
#
# install this as .git/hooks/pre-commit to check DNS zone files
# for errors before committing changes.
rc=0
@coxley
coxley / main.yml
Created November 17, 2015 21:22
-d tasks/main.yml
---
- include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "main.yml"
- name: packages | Install system packages
become: true
import copy
from pynsot.client import get_api_client()
api = get_api_client()
site = api.sites(api.default_site)
objects = site.networks.get(network_address='192.168.0.0')['data']['networks']
to_update = copy.deepcopy(objects)
[t['attributes'] = {} for t in to_update] # Strip the attributes
from __future__ import unicode_literals
"""
Loader for Trigger NetDevices using NSoT API.
Right now this loads ALL devices ALL the time, which scales very poorly with
the number of devices and attributes in NSoT.
To use this:
'''
Convert nsot csv to commands
'''
PATH = 'update.csv'
def create_net_cmd(resource):
'''pynsot bulk csv (colon) -> cli commands'''
cidr, attrs = resource.rsplit(':', 1)
return 'nsot networks add -c %s -a \'%s\'' % (cidr, attrs)
@coxley
coxley / pathviz.js
Created August 11, 2015 21:48
Takes raw ASPATH data and creates coordinate pairs
// The file being loaded by this program looks like:
// ---
// 3356 174 32780
// 6461 174 32780
// 6461 6453 12
// 209 2914 9268 131088
// 209 3257 8495 196624
// 6461 2914 9268 131088
// 6461 3320 8495 196624
// 6461 6939 293 16
"""
Description: Attempts to login as root with each password in the provided
password list. If successful, runs ``uname -a`` and prints to
stdout
Usage:
waruname.py <hosts_file> <password_list>
Options:
@coxley
coxley / interface-monitor
Created March 31, 2015 17:51
Monitor interface input and output bps/pps
#!/bin/env python2.7
"""
interface-rate
Usage:
interface-rate -c <host> -i <interface> [options]
Options:
-h --help Show this screen.