Skip to content

Instantly share code, notes, and snippets.

Avatar

Ethan J. Brown Iristyle

  • Puppet, Inc.
  • Portland, OR
View GitHub Profile
@Iristyle
Iristyle / Start-Vagrant.bat
Created Mar 15, 2013
Windows startup script to fire up a Vagrant VM safely on boot (using Run registry key for instance)
View Start-Vagrant.bat
ECHO OFF
cd /d %~dp0
for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G")
ECHO Close this window if it remains open, and http://localhost:8081 is responsive
IF "%STATE%" NEQ "saved" (
ECHO Starting Vagrant VM from powered down state...
vagrant up
) ELSE (
@Iristyle
Iristyle / search-connected-device.sh
Last active May 22, 2020
Search APKs for string
View search-connected-device.sh
# this assumes you've already connected to the target device with
# adb connect 192.168.X.X
# grab all the APKS off the device to local machine
# based on https://stackoverflow.com/a/4033005
# this works for firetv stick 4k, but didn't work on a slightly older device for some reason
# for i in $(adb shell pm list packages | awk -F':' '{print $2}'); do adb pull "$(adb shell pm path $i | awk -F':' '{print $2}')"; mv base.apk $i.apk 2&> /dev/null ;done
# use -f to grab path along with app and split it out in the loop
# additionally -3 lists only separately installed packages
# adb shell pm list packages -f -3
@Iristyle
Iristyle / docker-compose.yml
Created May 17, 2020
Pi-Hole Synology config
View docker-compose.yml
version: '2.4'
services:
# https://hub.docker.com/r/pihole/pihole/
pihole:
container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
environment:
- TZ=America/Los_Angeles
- DNS1=1.1.1.1
@Iristyle
Iristyle / docker-agent-clean.ps1
Last active May 12, 2020
Script to clean images, volumes and networks, hyper-v VMs and disk cache from degraded Azure CI system / agent
View docker-agent-clean.ps1
Write-Host "Waiting for containers to exit." -NoNewLine
while ($(docker ps -q))
{
Write-Host "." -NoNewLine
Start-Sleep 1
}
Write-Host
Write-Host "Stopping Azure Agent"
Stop-Service vstsagent*
@Iristyle
Iristyle / synology-check-transmission-tunnel-kill-if-dead.sh
Last active Apr 26, 2020
Check tunnel from inside Transmission openvpn container
View synology-check-transmission-tunnel-kill-if-dead.sh
# based on tunnelChecker from
# https://github.com/mrjackyliang/tunnelChecker
# modified to work on Alpine and doesn't require a script in the container
CONTAINER=transmission
# alpine container will always have ash (even if bash installed)
docker exec -i $CONTAINER sh <<'EOF'
PORT_FORWARD=12345
IP_CHECK=http://ipinfo.io/ip
@Iristyle
Iristyle / output.txt
Last active Apr 1, 2020
POSIX shell error-handling with set -e
View output.txt
# ./test.sh
140529043738688:error:20087002:BIO routines:BIO_lookup:system lib:../crypto/bio/b_addr.c:694:Name or service not known
connect:errno=2
else branch - ignored error - output: foo
command output:
bar
140510615253056:error:20087002:BIO routines:BIO_lookup:system lib:../crypto/bio/b_addr.c:694:Name or service not known
connect:errno=2
entered loop - ignored error
bar
@Iristyle
Iristyle / install-graphite-ubuntu-11.10.sh
Created Nov 12, 2011
Install Graphite 0.9.9 on Ubuntu 11.10 on EC2 with NGinx, uwsgi, supervisord, statsite, nagios agent
View install-graphite-ubuntu-11.10.sh
#!/bin/bash
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# Forked from: http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Ubuntu 11.10 Oneiric Ocelot
# Forked from https://gist.github.com/1287170
# Modified to use NGinx + uwsgi instead of Apache, as well as memcached and supervisord, incorporating ideas from
# http://blog.adku.com/2011/10/scalable-realtime-stats-with-graphite.html
@Iristyle
Iristyle / Bootstrap-EC2-Windows-CloudInit.ps1
Created Jan 24, 2012
Bootstrap Windows EC2 node with WinRM and CloudInit for making your own AMI
View Bootstrap-EC2-Windows-CloudInit.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 R2 Core x64 and Windows 2008 SP2 x86 AMIs provided
# by Amazon
#
# To run the script, open up a PowerShell prompt as admin
# PS> Set-ExecutionPolicy Unrestricted
# PS> icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/1672426/Bootstrap-EC2-Windows-CloudInit.ps1'))
@Iristyle
Iristyle / gist:5005653
Created Feb 21, 2013
Configure HAProxy for userlists
View gist:5005653

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0
View disable-windows-defender.ps1
# must be run as an admin
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name DisableAntiSpyware -Value 1
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name DisableRoutinelyTakingAction -Value 1
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name ServiceKeepAlive -Value 0
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender' -Name 'Exclusions' -ErrorAction Ignore
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions' -Name 'Exclusions_Paths' -Value 1
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions' -Name Paths -ErrorAction Ignore
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions\Paths' -Name 'Complete Drive' -Value 'C:\'