Skip to content

Instantly share code, notes, and snippets.

@ollyg
ollyg / gist:16680dba03c7a3d06646481c601f7502
Last active September 2, 2019 21:11
search and fix unescaped TT variables
# find files
g grep -cP "% [a-z][a-z._\(\/\)']+ %" share/views/
# vim command
.,$s:\(% \l[a-z._('/)]\+\) %:\1 | hmtl_entity %:cgI
reports:
- tag: hosts_network_today
label: 'Hosts On Network Today'
columns:
- {mac: 'MAC Address'}
- {dns: 'Router'}
- {port: 'Port'}
- {vlan: 'VLAN'}
- {ip: 'IP'}
- {nbname: 'NetBIOS'}
Device
GET /device??q={search}&{params} # Lists ALL devices OR filters by search and/or params, if present
# params: vendor, dns, name, location, ip, description
# these can hopefully be autogenerated/parsed
POST /device # Creates a device.
GET /device/{ip} # Gets Device Generic Info
GET /device/{ip}/{query}
# query is one of:
# Details
@ollyg
ollyg / gist:611b3cb119e890e1e48e9285429d15fa
Created March 17, 2019 20:27
API implementation notes
Search
Device
Port
VLAN
Node
Device
Details
Ports
Modules
@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