Skip to content

Instantly share code, notes, and snippets.

View yeled's full-sized avatar

Charlie Allom yeled

  • London
View GitHub Profile
@yeled
yeled / lsp_bw.sh
Created July 30, 2017 14:23
snmp scrape LSP bandwidths from your router
#!/bin/bash
set -e
HOST=$1
COMMUNITY=$2
# http://www.juniper.net/documentation/en_US/junos12.3/topics/reference/mibs/mib-jnx-mpls.txt
# The number of octets that have been forwarded over current LSP active path.
LSP_BYTES=".1.3.6.1.4.1.2636.3.2.3.1.3"
@yeled
yeled / napalm_cli.py
Last active August 1, 2017 12:18
napalm_cli.py
DOCUMENTATION = '''
---
module: napalm_cli
author: "Charlie Allom - based on napalm_ping Jason Edelman (@jedelman8)"
version_added: "2.2"
short_description: "Executes CLI commands and returns response using NAPALM"
description:
- "This module logs into the device, issues a ping request, and returns the response"
requirements:
- napalm
@yeled
yeled / portAutoDescription.py
Created September 4, 2017 16:28 — forked from markberly/portAutoDescription.py
Port auto-description tool automatically updates the port description of an interface based on the lldp neighbor information of the attached device. Utilizes Arista EOS eAPI.
#!/usr/bin/python
#
# Copyright (c) 2013, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#!/bin/bash
# 20171007
# Open in GitHub, astroidmail hook for message-view
# OSX only
# thread_view.run(hooks::github-go.sh %2)=G
ID=$1
FILE=$(notmuch search --output=files id:"$ID")
URL=$(for i in $FILE ; do
grep -iA1 'View it on GitHub:' $i |tail -1
@yeled
yeled / aggregate.c
Created October 30, 2017 22:18
aggregate
/* $Id: aggregate.c,v 1.12 2002/03/06 16:55:38 jabley Exp $
*
* Copyright (c) 2000-2001 by Metromedia Fiber Network Services, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND METROMEDIA FIBER NETWORK SERVICES,
* INC. ("MFN") DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
@yeled
yeled / patch.diff
Created November 9, 2017 10:51
use HTML as default in astroid
commit 1553d30965356c68c2fcaac99e2be0ad94d47675
Author: Charlie Allom <[email protected]>
Date: Thu Nov 9 10:42:52 2017 +0000
flip
---
src/chunk.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/chunk.hh src/chunk.hh
@yeled
yeled / make_patch.sh
Created January 8, 2018 17:10
make_patch.sh ./tmp/diffs/*
for i in $* ; do
SWITCH_DIFF=${i/tmp\/diffs\//}
SWITCH=${SWITCH_DIFF/.diff/}
echo "diff -r -u /dev/null ${SWITCH_DIFF}"
echo "--- /dev/null"
echo "+++ ${SWITCH} `date +%Y-%m-%d\ %H:%M:%S`.000000000 +0000"
cat <$i
echo
echo
done|source-highlight --failsafe -f esc --style-file=esc.style -s diff | less -cex4MRFX
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2
mQINBFHK/YsBEAC1mc4P3UjHptuFGA+nEvQeD3KqJ9bMdrOpiJU4XYwOch3JmFVt
D9kPupvaBU9ERDXol2GJ37dInaY1Z6w7dcCr89ZJxseix6+r6Q4Dd5RtGuj6Km1s
lmJSjBZW7gvgXo7hzipAIVlemEZFRkupZiMrn0Tq/yk2mAt9IC9Kg2PopP1qTImG
d9OWFueM6SHSgymg5+Ya+YoBRj4gTxHKqcYLooupHBnssSO4q9oRCid2BbGvhEV3
WRQKndfkJS3Q6qCIJnSGor5Zxg1z+SLe0r8qm2szdPRTEi/gi/rb4mquQwfqIpD0
4rxrYBmZeDUOhD/oiXp7qxHribf/DSBEKqPppTpBjcaUotwoqOjSHqxKWVVZPBL9
/tUNdYla5P/zruSyeeP26sYgqiSk6SSDCKT0oy3RYaldblEkx/mRc/fW4+9cMpsM
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2
mQINBFHK/YsBEAC1mc4P3UjHptuFGA+nEvQeD3KqJ9bMdrOpiJU4XYwOch3JmFVt
D9kPupvaBU9ERDXol2GJ37dInaY1Z6w7dcCr89ZJxseix6+r6Q4Dd5RtGuj6Km1s
lmJSjBZW7gvgXo7hzipAIVlemEZFRkupZiMrn0Tq/yk2mAt9IC9Kg2PopP1qTImG
d9OWFueM6SHSgymg5+Ya+YoBRj4gTxHKqcYLooupHBnssSO4q9oRCid2BbGvhEV3
WRQKndfkJS3Q6qCIJnSGor5Zxg1z+SLe0r8qm2szdPRTEi/gi/rb4mquQwfqIpD0
4rxrYBmZeDUOhD/oiXp7qxHribf/DSBEKqPppTpBjcaUotwoqOjSHqxKWVVZPBL9
/tUNdYla5P/zruSyeeP26sYgqiSk6SSDCKT0oy3RYaldblEkx/mRc/fW4+9cMpsM
bootstrap@ubnt1804template:~$ sudo tcpdump -ln -i ens160 net 151.101.0.0/16
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens160, link-type EN10MB (Ethernet), capture size 262144 bytes
07:47:32.104821 IP 10.10.0.100.50406 > 151.101.64.70.443: Flags [S], seq 3008037005, win 29200, options [mss 1460,sackOK,TS val 2040635067 ecr 0,nop,wscale 7], length 0
07:47:32.105277 IP 151.101.64.70.443 > 10.10.0.100.50406: Flags [S.], seq 1697483880, ack 3008037006, win 43440, options [mss 1460,sackOK,TS val 1925858942 ecr 2040635067,nop,wscale 9], length 0
07:47:32.105317 IP 10.10.0.100.50406 > 151.101.64.70.443: Flags [.], ack 1, win 229, options [nop,nop,TS val 2040635068 ecr 1925858942], length 0
07:47:32.105708 IP 10.10.0.100.50406 > 151.101.64.70.443: Flags [P.], seq 1:315, ack 1, win 229, options [nop,nop,TS val 2040635068 ecr 1925858942], length 314
07:47:32.106184 IP 151.101.64.70.443 > 10.10.0.100.50406: Flags [.], ack 315, win 85, options [nop,nop,TS val 1925858943 ecr 20