Skip to content

Instantly share code, notes, and snippets.

View peterneave's full-sized avatar

Peter Neave peterneave

  • Melbourne, Australia
  • 10:48 (UTC +11:00)
View GitHub Profile
peterneave / gitrandom.txt
Last active March 29, 2018 00:00
Git Random
View gitrandom.txt
#Make it easier working with upstream branches
git config --global pull.rebase true
git config --global rebase.autoStash true
#log difference between branches
git log --oneline --graph --all --decorate --abbrev-commit master..release/5.1.0
git log --left-right --graph --cherry-pick --oneline release/5.1.0...master
peterneave /
Created April 23, 2018 00:34

Keybase proof

I hereby claim:

  • I am peterneave on github.
  • I am peterneave ( on keybase.
  • I have a public key ASAK7gjJL7N0emCuCMYAc0LbVrKc68X3KnlNsk4K-WmLxQo

To claim this, I am signing this object:

peterneave / CreateNewBindings.ps1
Created June 6, 2018 01:21
Powershell Create IIS Web Binding
View CreateNewBindings.ps1
#Based on
function CreateNewBindings(
[parameter(Mandatory = $true, HelpMessage = 'Missing Argument WebsiteName')][string]$WebsiteName,
[parameter(Mandatory = $true, HelpMessage = 'Missing Argument HostHeader')][string]$HostHeader,
[parameter(Mandatory = $true, HelpMessage = 'Missing Argument CertCommonName')][string]$CertCommonName) {
Write-Host Creating new http binding $HostHeader on $WebsiteName
New-WebBinding -Name $WebsiteName -IPAddress "*" -Port 80 -Protocol http -HostHeader $HostHeader
Write-Host Creating new https binding $HostHeader on $WebsiteName with certificate $CertCommonName
New-WebBinding -Name $WebsiteName -IPAddress "*" -Port 443 -Protocol https -HostHeader $HostHeader -SslFlags 1
peterneave / .bashrc_windows
Last active June 12, 2018 23:45
Linux Run Commands
View .bashrc_windows
#! /bin/bash
eval `ssh-agent -s`
ls ~/.ssh/*_rsa | xargs echo Loading
ssh-add ~/.ssh/*_rsa
echo SSH Agent Loaded
peterneave / gist:334856152dcbd574b0eee0b7546cf17f
Created July 11, 2018 03:29
Setup Firewall with UFW on Debian/Ubuntu
View gist:334856152dcbd574b0eee0b7546cf17f
#See for more details on UFW commands
#change to root
sudo -i
#install ufw
apt install ufw
#enable writing logs to separate file
sed -i '/^#& ~/s/^#//' /etc/rsyslog.d/20-ufw.conf
peterneave / .profile
Last active September 20, 2018 06:53
Racher OS
View .profile
#!/usr/bin/env bash
function git () {
(docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git "$@")
function htop () {
(docker run --rm --pid=host -it imwithye/htop)
function vim () {
peterneave / logging.conf
Created December 12, 2018 01:36
Postgres Logging
View logging.conf
#Add to /etc/postgresql/10/main/conf.d/logging.conf and reload config
log_statement = 'none'
log_duration = off
log_min_duration_statement = 10000
log_lock_waits = on
peterneave /
Created December 14, 2018 05:23
Add datetime to log files
adddate() {
while IFS= read -r line; do
printf "%s %s\n" "[$(date +"%F %H:%M:%S")]" "$line"
$1 | adddate
peterneave /
Last active February 5, 2020 14:24
Setup Linux UFW Firewall to accept Atlassian IP addresses only
#!/usr/bin/env bash
> allowed_ranges
#Bamboo Triggers
echo '' >> allowed_ranges
echo '' >> allowed_ranges
echo '' >> allowed_ranges
#Atlassian IP Addresses
curl -s | jq -r '.items[] | .cidr' >> allowed_ranges
echo Allowed Ranges file generated
peterneave / EncryptDecryptRDCMan.ps1
Created October 7, 2021 22:21 — forked from heiny/EncryptDecryptRDCMan.ps1
Powershell: Encrypt/Decrypt Remote Desktop Connection Manager Credentials
View EncryptDecryptRDCMan.ps1
# There is no facility to replace passwords in RDCMan once they are stored. The only way is to create a new custom credential.
# If you open your *.rdg file in a text editor, locate the stored <password>, you can then decrypt it using this script.
# This script can also encrypt a plain text password in rdg format which can be used to overwrite an existing one in the xml.
Add-Type -AssemblyName System.Security;
Function EncryptPassword {
param([String]$PlainText = $null)
# convert to RDCMan format: (null terminated chars)