Skip to content

Instantly share code, notes, and snippets.

View tom-henderson's full-sized avatar
🇳🇿

Tom Henderson tom-henderson

🇳🇿
View GitHub Profile
# Git
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
source ~/Documents/Github/dotfiles/git-completion.bash
# AWS CLI
complete -C /usr/local/bin/aws_completer aws
[system.timezoneinfo]::GetSystemTimeZones() | Select Id, DisplayName
Get-ADUser -SearchBase "OU=AD Users,DC=example,DC=com" -Filter * -Properties msDS-UserPasswordExpiryTimeComputed, * | Sort Name | Select Name, Created, PasswordLastSet, @{Name="PasswordExpires";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}, PasswordExpired, PasswordNeverExpires, LockedOut, Enabled | Out-GridView
$size = 20Mb # Size in bits, eg 1Mb / 1Gb
$dest = 'Z:\Destination\'
fsutil file createnew "C:\temp\test.dat" ($size)
$Write = Measure-Command { Copy-Item "C:\temp\test.dat" "$dest\test.dat" }
$WriteMbps = [Math]::Round( (($size * 8) / $w.TotalSeconds) / 1Mb, 2 )
rm "C:\temp\test.dat"
# Set proxy for all users
# See:
# https://www.securelink.be/windows-proxy-settings-explained/
# https://technet.microsoft.com/en-us/library/cc770473(v=ws.11).aspx
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa362813(v=vs.85).aspx
$domain_name='example.com'
$proxy='proxy.foo.com'
$port=8080
$bypass = "10.*.*.*;"
Channel Availability Name
7 hd ondemand satellite Shine TV
8 hd ondemand Television 33
9 hd ondemand satellite TVNZ 1
10 hd ondemand satellite TVNZ 2
11 hd ondemand satellite Three
12 hd ondemand satellite Bravo
13 hd ondemand satellite Māori Television
18 hd ondemand satellite Parliament TV
20 hd ondemand satellite Te Reo
# https://duo.com/docs/radius
apt-get install build-essential libssl-dev python-dev libffi-dev
cd /tmp
wget -Oduoauthproxy-latest-src.tgz https://dl.duosecurity.com/duoauthproxy-latest-src.tgz
tar xzf duoauthproxy-latest-src.tgz
cd duoauthproxy-version-src
export PYTHON=python
$WUSession = New-Object -ComObject Microsoft.Update.Session
$WUSearcher = $WUSession.CreateUpdateSearcher()
$UpdateCollection = $WUSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")
$UpdateCollection.Updates | ft Title -AutoSize
function Recurse-PolicyKeys {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$GPOName,
[Parameter(Mandatory=$false)]
[string]$Key=“HKLM\Software”
)
$current = Get-GPRegistryValue -Name $gpoName -Key $key
<#
.SYNOPSIS
Set the state of a basic GPO setting
.DESCRIPTION
A Basic GPO setting has three possible states:
- Not Configured: The value is not present in the registry
- Enabled: The REG-DWORD is set to 0x00000001 (1)
- Disabled: The REG-DWORD is set to 0x00000000 (0)