Skip to content

Instantly share code, notes, and snippets.

@rpunt
rpunt / parallel_pull.sh
Last active August 16, 2016 12:42
Parallel git pulls
#!/usr/bin/env bash
superpull() {
dir=$1
error_repos=$2
cd $dir
STATUS=`mktemp`
echo -e "\n************************************\n* Pulling $dir\n************************************" >$STATUS
git checkout master 1>>$STATUS 2>&1
if [[ $? != 0 ]]; then

Keybase proof

I hereby claim:

  • I am rpunt on github.
  • I am rpunt (https://keybase.io/rpunt) on keybase.
  • I have a public key whose fingerprint is BF55 A76A E67F F3A1 2E09 E08F ED47 262D 3FF6 076A

To claim this, I am signing this object:

@rpunt
rpunt / 01-install-xenapp-6.ps1
Last active June 21, 2017 18:02
A fully-automated, silent install for XenApp 6 Enterprise on Server 2008 R2.
# This install assumes a couple things:
#
# 1. You're logged in as a local admin, per Citrix recommendations
# 2. These script files are store in d:\software\citrix6
# 3. The installation media for XenApp 6 has been unpacked in d:\software\citrix6\citrix6
# 4. The MSIs for Hotfix Rollup 2 and Profile Manager are located in d:\software\citrix6\citrix6\addons
# (these can be excluded by skipping "04-01-install-patches.bat"
#
# This install occurs across four reboots, and is complete unattended; you can kick it off
# when logged in via RDP or at the console, and let it run to completion. Run time is
@rpunt
rpunt / gitconfig
Created April 30, 2018 12:11
Git Configs
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
since = !git log $(git merge-base --fork-point master)..HEAD
files-changed="!f() { git log --name-only $1..HEAD --oneline --format=%n ${2:-.} | grep -v '^$' | sort | uniq; }; f"
@rpunt
rpunt / ntpconfig.ps1
Created January 21, 2019 15:49
Configure NTP on windows server
# from an elevated prompt
Stop-service w32time
w32tm /config /syncfromflags:manual /manualpeerlist:"server1.domain.tld,server2.domain.tld"
w32tm /config /reliable:yes
start-service w32time
# get sync status
W32tm /query /status
@rpunt
rpunt / unifi_keystore_gen.sh
Last active February 16, 2019 22:02
Generate a keystore for Unifi controllers
#!/bin/bash
# Assumptions:
# ./unifi.pem is the signed cert you wish to use
# ./unifi.key is the private key
# ./chain.pem is the CA chain for your issuer, ordered intermediates to root (descending)
# /var/lib/unifi/keystore is the appropriate path for your Keystore; may vary by distro (tested on Debian 8)
openssl pkcs12 -export \
-in unifi.pem \
# Create a DNS record in a Unifi USG
# ssh to USG
configure
# create an A record
set system static-host-mapping host-name HOSTNAME inet IPADDRESS
# create a CNAME
set system static-host-mapping host-name HOSTNAME alias CNAME
# get jail paths
root@freenas:~ > jls
JID IP Address Hostname Path
3 unifi /mnt/default/iocage/jails/unifi/root
root@freenas: > mv ~/keystore /mnt/default/iocage/jails/unifi/root/usr/local/share/java/unifi/data/
@rpunt
rpunt / check-windows-cert-expiry.ps1
Created August 7, 2019 15:07
Return days until cert expiration
# exit codes reflect this script's use as a Sensu check
# replace "YOUR ISSUER HERE" with the CA of your choice
param (
[Parameter(Mandatory=$True)][int]$critical = $(throw "-critical - is required."),
[Parameter(Mandatory=$True)][int]$Warning = $(throw "-warning - is required."),
[Parameter(Mandatory=$False)][string]$computer = $env:COMPUTERNAME.Tolower()
)
$cert=$(get-childitem cert:LocalMachine\My -recurse | where-object { $_.Issuer -match "YOUR ISSUER HERE" } | select Subject,@{Name="DaysRemaining";Expression={($_.NotAfter).subtract([DateTime]::Now).days}})
@rpunt
rpunt / mktemp.ps1
Created February 15, 2020 16:52
I've wanted mktemp in powershell forever, so... fine.
function mktemp {
param (
[Parameter(mandatory=$false)]$Extension
)
$randomfile = [System.IO.Path]::GetRandomFileName()
if ($Extension) {
$randomfile = [System.IO.Path]::ChangeExtension($randomfile, $Extension)
}
return Microsoft.PowerShell.Management\Join-Path ([System.IO.Path]::GetTempPath()) "$randomfile"
}