Skip to content

Instantly share code, notes, and snippets.

View jeffbrl's full-sized avatar

Jeff Loughridge jeffbrl

View GitHub Profile
@jeffbrl
jeffbrl / ce21.cfg
Last active July 31, 2026 22:13
ce21
!
no enable password
no aaa root
!
username admin privilege 15 role network-admin secret sha512 $6$yaIYtMPIq7w2sDmS$TPd7BFXCtHsTOOCkN/15qerEdGgkopnsRLbCYugcvNNQKMxyGllCbqxTw0UrP7WmSo3mYQDfIbXUqJTj41vZv/
username admin ssh-key ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILikHrz9717ue16sUBfJG2gnh+4m8tjuIMDO15I0bwQx network-labs-devices
username cvpadmin privilege 15 role network-admin secret sha512 $6$cvpadmin$KJbuVCyk6xrFZ.85XBW9dCbZCvy.5uav/ynHmWp/46CsshVsFD9Ht3TejCmdb.da/cfaox4q74uwsrG/sbcgA1
!
daemon TerminAttr
exec /usr/bin/TerminAttr -cvaddr=100.68.255.2:9910 -cvauth=token,/mnt/flash/token -cvvrf=MGMT -disableaaa -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -taillogs -cvsourceintf=Management0
@jeffbrl
jeffbrl / describe_instances.py
Created February 27, 2018 17:28
How to make datetime.datetime json serializable - boto3 ec2 describe_instances
# Adapted from https://stackoverflow.com/questions/35869985/datetime-datetime-is-not-json-serializable
import datetime
import json
import boto3
def datetime_handler(x):
if isinstance(x, datetime.datetime):
return x.isoformat()
@jeffbrl
jeffbrl / user-data.sh
Last active July 24, 2024 19:10
User-data for Amazon Linux 2 or 2023 Apache with Self-Signed Cert
#!/bin/bash -xe
# Use with Amazon Linux 2
# Amazon Linux 2023 doesn't seem to have make-dummy-cert script
yum update -y
yum install -y httpd mod_ssl
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
@jeffbrl
jeffbrl / linux-gui.yml
Last active June 2, 2024 23:54
Linux Bastion with GUI - CloudFormation template
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation template to create a linux bastion host with a GUI that can
be accessed via x2go.
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: String
VPC:
@jeffbrl
jeffbrl / server.py
Created April 12, 2024 20:15
Simple python webserver with HTTP header printing
import sys
from http.server import SimpleHTTPRequestHandler, HTTPServer
DEFAULT_PORT=8080
class RequestHandler(SimpleHTTPRequestHandler):
def do_GET(self):
print(self.headers)
SimpleHTTPRequestHandler.do_GET(self)
@jeffbrl
jeffbrl / user-data.yaml
Created October 21, 2018 00:04
AWS CloudFormation UserData Example
# This example is from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html.
UserData:
Fn::Base64:
!Sub |
#!/bin/bash -xe
yum update -y aws-cfn-bootstrap
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfig --configsets wordpress_install --region ${AWS::Region}
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource WebServerGroup --region ${AWS::Region}
@jeffbrl
jeffbrl / docker_cloud_init.sh
Last active March 10, 2024 16:28
Cloud-init for Debian Docker Host
#cloud-config
# Adapted from Mathew Dugan's article at https://matduggan.com/idiot-proof-infrastructure/
package_update: true
package_upgrade: true
package_reboot_if_required: true
groups:
- docker
@jeffbrl
jeffbrl / macro-test.slax
Created August 31, 2015 17:06
Example of using apply-macro as generic key/value store - SLAX
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
match / {
@jeffbrl
jeffbrl / userdata.sh
Last active August 8, 2023 21:14
AWS EC2 User Data for installing apache on Amazon Linux 2
#!/bin/bash -xe
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
@jeffbrl
jeffbrl / user-data.sh
Last active May 31, 2023 18:18
EC2 User data for Ubuntu 18.04 to create self-signed cert and configure apache2
#!/bin/bash
domain=example.com
commonname=example.com
country=US
state=Virginia
locality=Leesburg
organization=ExampleCo
organizationalunit=IT