Skip to content

Instantly share code, notes, and snippets.

@ollyg
ollyg / deployment.yml
Last active May 17, 2018 15:33
slower arp and mac polling, more workers
# the default is hourly
schedule:
macwalk:
when: '20 8,14,21 * * *'
arpwalk:
when: '50 8,14,21 * * *'
# the default is 50 minutes
jobs_stale_after: '6 hours'
@ollyg
ollyg / interfaces.pl
Last active April 9, 2018 07:28
Interface shortening note
m/^\D{2}/;
m/[^a-z]+$/i;
s/^(\D{2}).+[a-z]([^a-z]+)$/$1$2/;
@ollyg
ollyg / submodule.sh
Created March 4, 2018 09:27
Update git submodule to latest
cd submodule_name
git checkout master && git pull
cd ..
git add submodule_name
git commit -m "updating submodule to latest"
(from https://github.com/tj/git-extras/pull/80#issuecomment-3992323)
@ollyg
ollyg / docker-compose.yml
Created February 19, 2018 20:59
testing docker
version: '2.3'
services:
netdisco-postgresql:
image: netdisco/netdisco:latest-postgresql
volumes:
- "./netdisco/pgdata:/var/lib/postgresql/data"
# build:
# context: netdisco-postgresql
# netdisco-base:
# image: netdisco/netdisco:latest-base
@ollyg
ollyg / snmpwalk-fixups.sh
Created February 1, 2018 15:09
perl one liners to fix snmpwalk output so it works with snmpsimulator
# stitch together STRINGs that are broken over multiple lines
perl -0777 -pe 's/\n(?!\.1\.3\.6)//g'
# put quotes around STRINGs where they are missing
perl -pe 's/= STRING: (?!")(.*)/= STRING: "\1"/g'
@ollyg
ollyg / Notes-on-netdisco-docker.asciidoc
Last active January 8, 2018 14:48
Netdisco Docker Notes
  1. netdisco:db

    • IMAGE postgres:9.6.6-alpine

    • data volume

  2. netdisco:base

    • IMAGE debian:stable-slim

  3. netdisco:backend

    • IMAGE netdisco:base

    • config volume

    • MIBs

  4. netdisco:web

@ollyg
ollyg / dockerfile.sh
Last active January 7, 2018 19:38
netdisco docker notes
curl -s https://api.github.com/repos/netdisco/netdisco-mibs/tags | \
jq '.[]|.tarball_url|select(test("tarball/\\d+\\.\\d+$"))' | \
sort -rg | head -n1 | xargs -n1 curl -L | tar --strip-components=1 -zxf -
curl -s https://api.github.com/repos/netdisco/netdisco/tags | \
jq '.[]|.name|select(test("^\\d+\\.\\d+$"))|"git://github.com/netdisco/netdisco.git@"+.' | \
sort -rg | head -n1 | xargs -n1 cpanm --notest --local-lib $NETDISCO_HOME/perl5
@ollyg
ollyg / index.html
Last active December 27, 2017 08:41 — forked from donaldh/index.html
force with link labels
<html>
<head>
<title>Force with Labelled Links</title>
<script src="http://mbostock.github.com/d3/d3.js?2.9.2"></script>
<style type="text/css">
.node {
fill: #88f;
stroke: #44a;
stroke-width: 1px;
}
reports:
- tag: hosts_network_today
label: 'Hosts On Network Today'
columns:
- {mac: 'MAC Address'}
- {dns: 'Router'}
- {port: 'Port'}
- {vlan: 'VLAN'}
- {ip: 'IP'}
- {nbname: 'NetBIOS'}
@ollyg
ollyg / netdisco-import-unifi.pl
Created July 21, 2017 07:05
Collection script for UniFi AP controller
#!/usr/bin/env perl
use strict;
use warnings;
our $home;
BEGIN {
use FindBin;
FindBin::again();