Skip to content

Instantly share code, notes, and snippets.

@johnrizzo1
johnrizzo1 / nerd-font-install.sh
Created January 10, 2021 20:26
Script to install the latest nerd fonts
install_nerd_fonts() {
# https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip
TMPDIR=/tmp/nerd-font-install
URL="https://github.com/ryanoasis/nerd-fonts/releases/download"
VERSION="v2.1.0"
FONTS=(
3270
Agave AnonymousPro Arimo AurulentSansMono
BigBlueTerminal BitstreamVeraSansMono
CascadiaCode CodeNewRoman Cousine
@johnrizzo1
johnrizzo1 / gist:e09f5d7c56e19d50266b4a083d24610a
Created October 9, 2020 16:55
Remap SuperL/SuperR (Useful for Kinesis keyboards that use SuperR for the windows key)
xmodmap -e "keycode 134 = Super_L"
@johnrizzo1
johnrizzo1 / format.sh
Created October 9, 2019 18:46
bash formatted string
for i in $(seq 02 04); do
for j in $(seq 01 36); do
printf -v k "r%02dn%02d.sls\n" $i $j;
touch $k;
done;
done
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
@johnrizzo1
johnrizzo1 / Test-PendingReboot.ps1
Created July 17, 2018 19:17
Check if a windows server needs a reboot with powershell
# I found the following useful snippet here
# http://ilovepowershell.com/2015/09/10/how-to-check-if-a-server-needs-a-reboot/
#Adapted from https://gist.github.com/altrive/5329377
#Based on <http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542>
function Test-PendingReboot
{
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true }
if (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -EA Ignore) { return $true }
@johnrizzo1
johnrizzo1 / bing_image_archiver.sh
Created July 17, 2018 15:24
Windows 10 Bing Image Archiver
#!/usr/bin/env bash
# Copy any of the bing downloaded images that are used on the windows 10 lock screen.
# Once you set this up you can then set your background to slideshow and point it
# to the archive directory
#
# This was taken from somewhere I'd like to attribute but can't find the URL.
# If this is yours please let me know and I'll attribute you.
IMAGE_FOLDER="/mnt/c/Users/jrizzo/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets"
LIST_SOURCE="/mnt/c/tmp/spotlight/listsource.txt"
@johnrizzo1
johnrizzo1 / gist:a872f37bf0e778f3675008a379e2b128
Created September 13, 2017 14:47
Quick Clearing of Docker Logs
truncate -s 0 /var/lib/docker/containers/*/*-json.log
$env:VAGRANT_DEBUG_LAUNCHER=1; vagrant ssh --debug > debug.txt | tee-object -variable debugvar
2017/09/12 13:56:40 launcher: path = C:\HashiCorp\Vagrant\bin\vagrant.exe
2017/09/12 13:56:40 launcher: installerDir = C:\HashiCorp\Vagrant
2017/09/12 13:56:40 launcher: embeddedDir = C:\HashiCorp\Vagrant\embedded
2017/09/12 13:56:40 launcher: gemPaths (initial) = []string{"C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.9.8", "C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-share-1.1.9"}
2017/09/12 13:56:40 launcher: bad gemPath += C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-share-1.1.9\lib\vagrant\version.rb
2017/09/12 13:56:40 launcher: gemPaths (final) = []string{"C:\\HashiCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.9.8"}
2017/09/12 13:56:40 launcher: gemPath = C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.8
2017/09/12 13:56:40 launcher: windows detected OS - msys
2017/09/12 13:56:40 launcher: windows detected arch - 32
$switchName = "nat_switch"
$network = "192.168.0.0"
$networkMask = "24"
$defaultGateway = "192.168.0.1"
New-VMSwitch -SwitchName $switchName -SwitchType Internal
$networkAdapter = Get-NetAdapter | where { $_.Name -eq "vEthernet ($switchName)" }
New-NetIPAddress -IPAddress $defaultGateway -PrefixLength $networkMask -InterfaceIndex $networkAdapter.ifIndex
New-NetNat -Name $networkAdapter.ifIndex -InternalIPInterfaceAddressPrefix $network/$networkMask
# References
@johnrizzo1
johnrizzo1 / init.sls
Created August 23, 2017 15:37
aws salt-stack issue
/srv/pillar/aws/init.sls which is called from /srv/pillar/aws/top.sls
aws:
accounts:
common:
iam_groups:
- aws-common_admin:
- permissions:
- managed_policies:
- AdministratorAccess