Skip to content

Instantly share code, notes, and snippets.

View heywoodlh's full-sized avatar
:octocat:
Trapped in Vim

Spencer Heywood heywoodlh

:octocat:
Trapped in Vim
View GitHub Profile
@heywoodlh
heywoodlh / reset-terminal-services.ps1
Created September 1, 2017 14:49
Script for renewing RDP License
## This Script is intended to be used for Querying remaining time and resetting Terminal Server (RDS) Grace Licensing Period to Default 120 Days.
## Developed by Prakash Kumar (prakash82x@gmail.com) May 28th 2016
## www.adminthing.blogspot.com
## Disclaimer: Please test this script in your test environment before executing on any production server.
## Author will not be responsible for any misuse/damage caused by using it.
Clear-Host
$ErrorActionPreference = "SilentlyContinue"
## Display current Status of remaining days from Grace period.
@heywoodlh
heywoodlh / lynis.sh
Last active September 12, 2017 03:05 — forked from foozmeat/lynis.sh
Script to run lynis and notify you if something needs attention
#!/bin/sh
#set -x
EMAIL=l.spencer.heywood@gmail.com
. /etc/apache2/envvars
/usr/sbin/lynis -c -Q -q --profile /etc/lynis/default.prf
# Check to ensure we're still at 100%
@heywoodlh
heywoodlh / facebook-search.py
Created September 15, 2017 16:43
Facebook Search
#!/usr/bin/env python3
import sys
import requests
from bs4 import BeautifulSoup as bs
try:
firstname = sys.argv[1]
except IndexError:
print('Usage: ' + sys.argv[0] + ' firstname lastname')
sys.exit(1)
@heywoodlh
heywoodlh / email.html
Created October 23, 2017 16:42
Sample email html template
<html>
<head>
<title>Sample email html template</title>
</head>
<body>
@heywoodlh
heywoodlh / anti-ddos.yml
Created October 25, 2017 21:07
Ansible playbook to install Anti-DDOS script: https://github.com/ismailtasdelen/Anti-DDOS.git
---
- hosts: my-webservers
tasks:
- name: download the git repository
command: git clone https://github.com/ismailtasdelen/Anti-DDOS.git /tmp/Anti-DDOS
- name: run the shell script
command: bash /tmp/Anti-DDOS/anti-ddos.sh
become: true
@heywoodlh
heywoodlh / aws-ip-checker.sh
Created November 6, 2017 22:34
Scripts used to grab links from a website and compare to see if they are on Amazon Web Services
#!/usr/bin/env bash
if [ "$1" == '' ]
then
echo "usage: $0 domain.com"
exit 1
fi
DOMAIN="$1"
@heywoodlh
heywoodlh / delete-chrome-cookies.sh
Last active November 29, 2017 18:09
Delete all Chrome cache/cookies for every user on OS X
#!/usr/bin/env bash
USERS="$(ls /Users)"
#echo "$USERS"
for user in "$USERS"
do
CHROME_COOKIES="/Users/$user/Library/Application Support/Google/Chrome/Default/Cookies"
if [ -f "$CHROME_COOKIES" ]
@heywoodlh
heywoodlh / admin-notify.sh
Last active December 8, 2017 01:28
Script to notify if a login is detected from an admin user on a computer
#!/usr/bin/env bash
ADMINISTRATOR1="admin_user1"
ADMINISTRATOR2="admin_user2"
MY_IP="$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}')"
MY_IP="$MY_IP"
ACCOUNTS="$(who)"
if echo "$ACCOUNTS" | grep --quiet -e "$ADMINISTRATOR1" -e "$ADMINISTRATOR2"
@heywoodlh
heywoodlh / kiosk.sh
Last active December 20, 2017 18:00
Simple kiosk script for the Raspberry Pi
#!/bin/bash
## See https://obrienlabs.net/setup-raspberry-pi-kiosk-chromium/ for more information
## Add this one liner to the end of ~/.config/lxsession/LXDE-pi/autostart after downloading this script to /home/pi/kiosk.sh and making it executable:
## @/home/pi/kiosk.sh
WEBSITE='https://google.com'
# Hide the mouse from the display
unclutter &
@heywoodlh
heywoodlh / base-dn.py
Last active January 10, 2018 18:15
Print base dn for Active Directory domain using Python
#!/usr/bin/env python3
domain = 'ad.domain.org'
bases = domain.split('.')
bases_total = len(bases)
global base_domain
base_domain = ''
run = 0
for base in bases:
if run == 0: