Skip to content

Instantly share code, notes, and snippets.

View snipe's full-sized avatar
😁
Jazzed to be releasing Snipe-IT v7 soon!

snipe snipe

😁
Jazzed to be releasing Snipe-IT v7 soon!
View GitHub Profile
@snipe
snipe / fartgun.txt
Last active July 26, 2023 17:37
Pre-commit hook to prevent dummy text from being committed
#!/bin/sh
#
# This git hook should let us prevent commits from containing words that we sometimes use
# as "sky is blue" proof that a method is working when it's behaving strangely.
disallowed="poop fart poopy farty shit fuck"
git diff --cached --name-status | while read x file; do
if [ "$x" == 'D' ]; then continue; fi
for word in $disallowed
@snipe
snipe / google-script-update-asset-tags-by-id.md
Last active December 12, 2023 22:41
Google App Script to bulk change asset tags in Snipe-IT by asset ID

Snipe-IT offers a way to bulk regenerate asset tags all at once, but updating only certain asset tags in bulk can only be done via API, since asset tag is currently the unique identifier for assets within Snipe-IT.

This Google App Script will let you provide a list of Asset IDs and the new asset tags they should use, along with showing you the status of the request, without having to know how to write code to use the Snipe-IT API.

This script expects a CSV that has a header row (though it doesn't matter what the header names are) with the first column being the internal Snipe-IT asset ID, and the second column being the new asset tag you want to change it to.

Screenshot 2023-12-12 at 10 07 09 PM

Code: