Skip to content

Instantly share code, notes, and snippets.

View awfki's full-sized avatar

Dave awfki

  • Atlanta, GA
View GitHub Profile
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
#HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@awfki
awfki / ToggleAirport Installation.md
Last active June 8, 2017 17:46 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@awfki
awfki / addresses.py
Created October 26, 2017 13:27 — forked from candlerb/addresses.py
Netbox report to check for missing Primary IP Addresses
from extras.reports import Report
from dcim.models import Device
from virtualization.models import VirtualMachine
from ipam.constants import *
from ipam.models import IPAddress, Prefix
LOOPBACK_ROLES = [
IPADDRESS_ROLE_LOOPBACK,
IPADDRESS_ROLE_ANYCAST,
IPADDRESS_ROLE_VIP,
@awfki
awfki / netbox-ansible.py
Created October 26, 2017 13:43 — forked from linuxsimba/netbox-ansible.py
Ansible Netbox Integration Example
#!/usr/bin/python
""" Ansible Inventory Generated From Netbox
Author: Stanley Karunditu <stanley@linuxsimba.com>
License: MIT
Requirements:
* use netbox device roles that result in hyphenated role names. E.g
@awfki
awfki / leasecheck.pl
Created December 12, 2017 18:46 — forked from mattpascoe/leasecheck.pl
Perl script to parse ISC DHCP lease file and display basic info. I dont recall if I wrote this or if I found it on the interwebs somewhere!?!?.. a quick goog search did not find it but hey its useful so have at it.
#!/usr/bin/perl
#
# Update the path to your lease file below
use strict;
use File::Copy;
#use DateTime;
#always parse a copy not the live file
#my $leasefile = '/var/lib/dhcpd/dhcpd.leases';
my $leasefile = '/var/lib/dhcp/db/dhcpd.leases';
@awfki
awfki / uncipher.py
Created January 16, 2018 03:23 — forked from jayswan/uncipher.py
Python: reverse Cisco type 7 passwords with input from file or stdin
"""
Uncipher Cisco type 7 ciphered passwords
Usage: python uncipher.py <pass> where <pass> is the text of the type 7 password
Example:
$ python uncipher.py 094F4F1D1A0403
catcat
"""
import fileinput
import sys
@awfki
awfki / Bash string manipulation cheatsheet.md
Last active November 19, 2019 19:25 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set. Value will be returned.

Couple with : no-op if return value is to be discarded.
${variable="value"}
: ${variable="value"}

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

ipconfig getifaddr en0

Same thing, but setting and echoing a variable: