Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tcuthbert on github.
  • I am tcuthbert (https://keybase.io/tcuthbert) on keybase.
  • I have a public key ASD_756RNhpxphCUTm0ePLiSPHqgHhRPf9le06XliseN3go

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
"""
Login and basic command-line interaction support using the Twisted asynchronous
I/O framework. The Trigger Twister is just like the Mersenne Twister, except
not at all.
"""
from __future__ import absolute_import
from collections import deque
def parse_template(self, results, device, commands=None):
"""
Generator function that processes unstructured CLI data and yields either
a TextFSM based object or generic raw output.
:param results:
The unstructured "raw" CLI data from device.
:type results:
str
:param device:
#!/usr/bin/env python
import sys
from time import sleep
from twisted.internet.defer import Deferred
from zope.interface import implements
from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
from twisted.internet.defer import succeed
from trigger.cmds import Commando
from functools import partial
class ShowShit(Commando):
vendors = ['cisco']
commands = ['show motd | in KEEP IT REAL APPLE PEEL']
def handle_motd(self, results, device):
if "KEEP IT REAL APPLE PEEL" in results:
call plug#begin('~/.vim/plugged')
" Defaults
Plug 'tpope/vim-sensible'
" Git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" Make sure you use single quotes
@tcuthbert
tcuthbert / 70-intel.conf
Last active December 20, 2016 04:18
Fix poor performance for Skylake HD integrated GPU
Section "Extensions"
Option "XVideo" "Disable"
EndSection
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "sna"
Option "TearFree" "true"
Option "DRI" "true"
import sys
from datetime import timedelta
from time import asctime, localtime, time
from trigger.cmds import Commando
class ShowTech(Commando):
"""Execute 'show clock' on a list of Cisco devices."""
vendors = ['cisco']
commands = ['show tech-support']
from datetime import timedelta
from time import asctime, localtime, time
from trigger.cmds import Commando
class ShowTech(Commando):
"""Execute 'show clock' on a list of Cisco devices."""
vendors = ['cisco']
commands = ['show tech-support']
if __name__ == '__main__':
import sys
import pprint
from copy import copy
from itertools import tee, izip, dropwhile, imap, groupby, ifilterfalse
from operator import itemgetter
from netaddr import IPAddress, IPNetwork
from trigger.cmds import Commando
from trigger.netdevices import NetDevices
from collections import defaultdict, namedtuple
from graphviz import Digraph