Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kbni on github.
  • I am kbni (https://keybase.io/kbni) on keybase.
  • I have a public key ASDqHaSe6rQElE-gX3Bn_a3cqTVz-H8MlBBsZPzXeClOfQo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am kbni on github.
* I am kbni (https://keybase.io/kbni) on keybase.
* I have a public key ASDqHaSe6rQElE-gX3Bn_a3cqTVz-H8MlBBsZPzXeClOfQo
To claim this, I am signing this object:
@kbni
kbni / Get-CuteIconsFromInterwebs.ps1
Created June 28, 2021 23:25
Download some cute icons I found on the interwebs
Set-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
$IconDownloadTemplate = 'https://img.icons8.com/windows/2x/{colour}/{thing}.png'
$IconSaveTemplate = 'icons/{thing}.{colour-name}.png'
$WantedIcons = @'
https://img.icons8.com/windows/2x/{colour}/server
https://img.icons8.com/windows/2x/{colour}/windows-client
https://img.icons8.com/windows/2x/{colour}/linux-client
https://img.icons8.com/windows/2x/{colour}/mac-client
@kbni
kbni / HaloPSA-Tweaks-UserScript.js
Last active May 27, 2021 03:43
HaloPSA Tweaks (User Script)
// ==UserScript==
// @name HaloPSA Tweaks
// @namespace https://kbni.net.au/
// @version 20210528.1342
// @description just some HaloPSA tweaks
// @author Alex Wilson
// @match https://psa.anspired.com.au/*
// @grant none
// ==/UserScript==
@kbni
kbni / BulkTerminateAlarms
Created January 24, 2021 22:44
Bulk Terminate Alarms by NXSL
sub bulk_terminate_alarms(limit) {
counter = 0;
clear_key_regex = "^(SW_PKG)";
clear_message_regex = "(changed to UNSUPPORTED)$";
for (n : GetAllNodes()) {
for (a : n->alarms) {
if(a->state == 0 && (a->key ~= clear_key_regex || a->message ~= clear_message_regex)) {
a->terminate();
println("Alarm terminated: " . a->key . ": " . a->message);
@kbni
kbni / encoder.py
Created March 2, 2018 05:02
Serialiser for nameko
import json
from datetime import datetime, timedelta
import pendulum
import pytz
from kombu.serialization import register
from miso.utils import ServiceResult
class SpecialJSONEncoder(json.JSONEncoder):
"""
@kbni
kbni / automunch.py
Created March 2, 2018 03:55
AutoMuncher for munch
from munch import munchify, Munch
def automunchify(data):
return munchify(data, AutoMunch)
class AutoMunch(Munch):
""" For convenience, we'll use this instad of the standard Munch so if we add a dict
into the Munch that dict itself will be munchified.
@kbni
kbni / zatoctl.sh
Created September 21, 2016 07:53
#!/usr/bin/env bash
# Author: Alex Wilson <admin@kbni.net>
#
# Basic script to assist with managing zato hosts
function script_help() {
echo "$(basename "$0") - Zato control script"
echo "author: Alex Wilson <admin@kbni.net>"
echo ""
echo "arguments:"
#!/usr/bin/env bash
# Author: Alex Wilson <admin@kbni.net>
#
# Basic script to assist with managing zato hosts
function script_help() {
echo "$(basename "$0") - Zato control script"
echo "author: Alex Wilson <admin@kbni.net>"
echo ""
echo "arguments:"
@kbni
kbni / RollingCheckpoints.ps1
Last active June 16, 2016 19:06
rolling checkpoints? :D
#$VerbosePreference = "Continue"
$SnapShotVM = @("KBNI-TS1", "KBNI-DC1", "KBNI-WWW1")
$LogFile = "C:\Logs\RollingCheckpoints.txt"
$LogDir = New-Item -Type Directory -Path (Split-Path -Path $LogFile)
Foreach($VM in $SnapShotVM) {
$m = Measure-Command { Get-VM $VM | Get-VMSnapshot | Sort-Object -Descending | Select -Skip 24 | Remove-VMSnapshot -Verbose | Out-Host }
$log = [string]::Format("Removing old snapshots for ${VM} took {0:N2} seconds", $m.TotalSeconds)
$log | Out-Host
$log | Out-File -Append -FilePath $LogFile