Skip to content

Instantly share code, notes, and snippets.

@johnrizzo1
johnrizzo1 / gist:6073853
Created July 24, 2013 19:45
sublime_keybinding
{ "keys": ["super+shift+o"], "command": "code_formatter", "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.javascript" }
]
}

Keybase proof

I hereby claim:

  • I am johnrizzo1 on github.
  • I am johnrizzo1 (https://keybase.io/johnrizzo1) on keybase.
  • I have a public key whose fingerprint is 2D6C 8774 21D8 3227 366D 4F53 1BAC 56AE 29C2 FFB4

To claim this, I am signing this object:

# Purpose: Read a file and parse each line into two variables
# File Format
# Each line is a space separated set of fields
# $first - the first field in the file
# $rest - all remaining fields in the file
while read i
do
echo $i
first=${i[(w)0]}
print "\tFirst: $first\n"
@johnrizzo1
johnrizzo1 / Vagrant_HyperV Development Notes
Created April 27, 2017 19:56
Vagrant_HyperV Development Notes
HyperV Support
- Get Static IP Working
- Public, Private and External
- Get DHCP Working
- Public and Private but probably not external
- Move network selection to the config.vm.network definition (bridge???) instead of provider options
- Install Linux Integration Services on Linux Guests
- Add obvious provider options such as
HyperV Network Types
@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
$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
$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
@johnrizzo1
johnrizzo1 / gist:a872f37bf0e778f3675008a379e2b128
Created September 13, 2017 14:47
Quick Clearing of Docker Logs
truncate -s 0 /var/lib/docker/containers/*/*-json.log
@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 / 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 }