Skip to content

Instantly share code, notes, and snippets.

View tylerapplebaum's full-sized avatar
☁️
AWS + Networking

Tyler Applebaum tylerapplebaum

☁️
AWS + Networking
View GitHub Profile
@tylerapplebaum
tylerapplebaum / Sync-Items.ps1
Created July 2, 2021 22:53
Sync items using a PowerShell wrapper around robocopy
#https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx
#http://www.luisrocha.net/2008/12/robocopy-error-error-5-0x00000005.html
# Robocopy switches used:
#/MIR - mirror directory structure (including empty)
#/COPY:DT - excludes copying permissions
#/XA:H - excludes hidden files
#/W:5 - wait 5 seconds on a failure
#/XJD - exclude junction points
#/XD - exclude directory
@tylerapplebaum
tylerapplebaum / ffrouting-install.sh
Last active May 28, 2021 22:38 — forked from chriselsen/ffrouting-install.sh
FFRouting on Ubuntu 20.04
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y
# Dependencies
sudo apt-get install -y \
git autoconf automake libtool make libreadline-dev texinfo \
pkg-config libpam0g-dev libjson-c-dev bison flex python3-pytest \
libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \
install-info build-essential libsystemd-dev libsnmp-dev perl libcap-dev \
@tylerapplebaum
tylerapplebaum / Clear-RecentItems
Last active September 15, 2024 16:35
Remove recent files and jump list entries on Windows 10
Function Clear-RecentItems {
$Namespace = "shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}"
$QuickAccess = New-Object -ComObject shell.application
$RecentFiles = $QuickAccess.Namespace($Namespace).Items()
$RecentFiles | % {$_.InvokeVerb("remove")}
Remove-Item -Force "${env:USERPROFILE}\AppData\Roaming\Microsoft\Windows\Recent\*.lnk"
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs" -Value 0 -PropertyType DWORD
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs"
@tylerapplebaum
tylerapplebaum / VPC CLI.ps1
Created December 6, 2019 23:40
Create an AWS VPC with public, private IPv4 and IPv6 subnets, NAT GW, Internet GW, Egress-Only IGW, and all routes
#To-do
# Create security group for private subnet and allow ICMPv4, ICMPv6 and SSH from public subnet.
$SubnetIncrement = 1
$SubnetIPv4CIDR = "172.31.0.0/16"
$VPC = aws ec2 create-vpc --cidr-block $SubnetIPv4CIDR --amazon-provided-ipv6-cidr-block --region us-west-2 | ConvertFrom-Json | Select-Object -ExpandProperty Vpc
aws ec2 create-tags --resources $VPC.VpcId --tags Key=Name,Value=TFC-Study
@tylerapplebaum
tylerapplebaum / Find-EC2InstanceAvailabilityByRegion.ps1
Last active December 3, 2019 22:24
Find EC2 instance availability among all public regions
#Check for EC2 instance type availability among all public regions
#Prerequisites - the most current AWS CLI installation - https://aws.amazon.com/cli/
[CmdletBinding()]
param(
[Parameter(HelpMessage="Specify the API name of the EC2 instance type to search for. Example: t3a.small")]
[ValidateNotNullOrEmpty()]$InstanceType
)
$RegionsJson = aws ec2 describe-regions
@tylerapplebaum
tylerapplebaum / Sync-Documents.ps1
Created October 24, 2019 21:18
Robocopy wrapper to mirror directory to backup drive. Includes path validation.
#https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx
#http://www.luisrocha.net/2008/12/robocopy-error-error-5-0x00000005.html
#Robocopy switches used:
#/MIR - mirror directory structure (including empty)
#/COPY:DT - excludes copying permissions
#/XA:H - excludes hidden files
#/W:5 - wait 5 seconds on a failure
#/XJD - exclude junction points
@tylerapplebaum
tylerapplebaum / Create-HiddenDirectories
Created October 24, 2019 21:15
Create Hidden Directories
ForEach ($Folder in @("Folder 1","Folder A","Folder A-Z")) {
New-Item -ItemType Directory -Path $DestDir -Name $Folder | Set-ItemProperty -Name Attributes -Value Hidden
}
@tylerapplebaum
tylerapplebaum / bootstrap.sh
Last active August 13, 2019 21:12
Bootstrap for Amazon Linux 2 EC2 instances
#!/bin/bash
sudo yum install httpd
usermod -a -G apache ec2-user
sudo chown -R ec2-user:apache /var/www
sudo systemctl restart httpd.service
sudo systemctl enable httpd.service
public_ipv4=$(curl -s "http://169.254.169.254/latest/meta-data/public-ipv4")
sudo echo $public_ipv4 > /var/www/html/public-ipv4.txt
cd /var/www/html
curl -O https://gist.githubusercontent.com/tylerapplebaum/98a940c312724ae6a0838d43afc2a592/raw/85523ac76edf2c68ee7431839784dff4313b723a/index.html
fsutil.exe file createNew file.txt 2645789412
.\zip2john.exe "C:\Users\derp\Downloads\Tester.zip" | Out-File C:\Users\derp\Downloads\Tester.hash -Encoding utf8
& type C:\Users\derp\Downloads\Tester.hash
.\john.exe C:\Users\derp\Downloads\Tester.hash
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 8 OpenMP threads
Proceeding with single, rules:Single