Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nick Shores nshores

🏠
Working from home
View GitHub Profile
@Dapacruz
Dapacruz / panorama-dynamic-inventory.py
Created Aug 7, 2020
Panorama Dynamic Inventory for Ansible Tower
View panorama-dynamic-inventory.py
#!/usr/bin/env python2.7
import argparse
import json
import os
import sys
import urllib
import urllib2
import xml.etree.ElementTree as ET
@Dapacruz
Dapacruz / Redirect-VMHostLogs.ps1
Last active Oct 16, 2018
Redirect VMware ESXi Host Logs
View Redirect-VMHostLogs.ps1
$hosts = '*'
$datastore_name = 'NS-VMFS-01'
$datastore = Get-Datastore -Name $datastore_name | Select-Object -First 1
$log_dir = '[{0}] Logs' -f $datastore.Name
$scratch_location = '{0}/Logs' -f $datastore.ExtensionData.Info.Url -replace 'ds://'
foreach ($h in (Get-VMHost $hosts | Sort-Object -Property Name)) {
Write-Host "$($h.Name): Redirecting log files ..."
$result = Get-AdvancedSetting -Entity $h -Name Syslog.global.logDir | Set-AdvancedSetting -Value "$log_dir/$h" -Confirm:$false
Write-Host "New syslog location: $($result.Value)"
@Dapacruz
Dapacruz / Configure-Ntp.ps1
Created Dec 7, 2017
Configure/Enable NTP on a VMware ESXi Host
View Configure-Ntp.ps1
$hosts = '*'
$ntp_servers = '10.10.1.10', '10.10.1.5'
Get-VMHostService -VMHost $hosts | Where-Object {$_.key -eq 'ntpd'}
Get-VMHostNtpServer -VMHost $hosts
Add-VMHostNtpServer -VMHost $hosts -NtpServer $ntp_servers
Get-VMHostService -VMHost $hosts | Where-Object {$_.key -eq 'ntpd'} | Start-VMHostService | Set-VMHostService -Policy 'automatic'
@prasanthj
prasanthj / lirc-pi3.txt
Last active Oct 7, 2020
Getting lirc to work with Raspberry Pi 3 (Raspbian Stretch)
View lirc-pi3.txt
Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 (bought from Amazon [1]).
The vendor has some documentation [2] but that is not complete and sufficient for Raspbian Stretch.
Following are the changes that I made to make it work.
$ sudo apt-get update
$ sudo apt-get install lirc
# Add the following lines to /etc/modules file
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17
@vidia
vidia / nginx-unificontroller.conf
Last active Oct 19, 2020
Example, working, NGINX config for proxying to Unifi Controller software and using letsencrypt. Includes websocket fix.
View nginx-unificontroller.conf
# I had a bit of trouble getting my unifi controller (hosted offsite) to use a proxy/letsencrypt. So here are the fruits of my labor.
# The unifi default port is 8443 running on localhost.
# License: CC0 (Public Domain)
server {
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
@mobzystems
mobzystems / Start-FileSystemWatcher.ps1
Last active Oct 13, 2020
Using a FileSystemWatcher from PowerShell
View Start-FileSystemWatcher.ps1
# Start-FileSystemWatcher.ps1 - File System Watcher in Powershell.
# Brought to you by MOBZystems, Home of Tools
# https://www.mobzystems.com/code/using-a-filesystemwatcher-from-powershell/
[CmdletBinding()]
Param(
# The path to monitor
[Parameter(Mandatory=$true, Position=0)]
[string]$Path,
# Monitor these files (a wildcard)
@jchandra74
jchandra74 / PowerShell Customization.md
Last active Oct 24, 2020
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization
View PowerShell Customization.md

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@morisy
morisy / Reset-LocalAccountPassword.ps1
Created Mar 8, 2017
This article presents a new script, Reset-LocalAccountPassword.ps1, which makes it easier and more secure to reset local account passwords on computers.
View Reset-LocalAccountPassword.ps1
# Reset-LocalAccountPassword.ps1
# Written by Bill Stewart (bstewart@iname.com)
#requires -version 2
<#
.SYNOPSIS
Resets the built-in Administrator account or a named local account password on one or more computers.
.DESCRIPTION
@savetheclocktower
savetheclocktower / README.md
Last active Oct 10, 2020
Poor-man's LEDBlinky with RetroPie and Pac-Drive
View README.md

NOTE: This Gist was an early write-up of this blog post, part of what became an eleven-part series on my arcade cabinet. I'd suggest you read that post instead of this, but some of the comments on this Gist contain updates and field reports that you might find useful.

RetroPie, LED control, and you

I wanted LEDBlinky-style functionality out of my RetroPie cabinet. But I didn't need RGB control or magical frontend integration or anything like that. I had buttons with simple single-color LEDs.

I've got a simple control panel with six buttons per player. All I wanted was this:

  • When I launch Street Fighter 2, all twelve buttons should light up.
  • When I launch The Simpsons, only the first two buttons for each player should light up.
@jsanz
jsanz / ovafix.md
Last active Jan 10, 2019
Making a OVA file compatible with VMWare
View ovafix.md

This is a recipe to fix this error when importing to VMWare an OVA file:

Download and install OVFTool (https://www.vmware.com/support/developer/ovf/)

Convert OVA to VMX using the command below (this will create example.vmx)

$ ovftool example.ova example.vmx
You can’t perform that action at this time.