Skip to content

Instantly share code, notes, and snippets.

View snipe's full-sized avatar
😩
So jetlag. Much tired.

snipe snipe

😩
So jetlag. Much tired.
View GitHub Profile
@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:

@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 / anxiety-depression-covid19
Last active June 27, 2023 07:01
Managing stress, anxiety and depression during Covid-19
This list started as a Slack message, turned into a company email, then turned
into a blog post to include things *organizations* can do to manage this difficult time.
You can read the final blog post here: https://snipe.net/2020/03/24/managing-stress-anxiety-and-depression-during-covid-19/
------------------
Hi all,
I posted this to slack (and pinned it), but just in case you missed it, here it is in email.
@snipe
snipe / gist:936bf578fea346e0c16845a7146d7f59
Last active March 23, 2018 23:04
Snipe-IT tinker cached .env recover for wiped file
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
APP_KEY=ChangeMe
APP_URL=null
APP_TIMEZONE='UTC'
APP_LOCALE=en
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use PDF;
$info = [
'deal' => [
'name' => 'Plan Name',
'amount' => 100,
'stage_name' => 'won',
'closed_date' => '2017-06-02',
'deal_stage_id' => 'DEAL-STAGE-ID',
'sales_account' => [
'name' => 'Account Name',
'website' => 'http://example.org'
<?php
/*
* Use Case:
* You have multiple deleted_at items that share an attribute that is supposed to be unique,
* for example, a username in a user's table, and are using model-level validation and watson/validation
*
* In this use case, you want to ignore ALL deleted items when considering uniqueness.
*
* The current `unique` validation rule doesn't seem to do this, even when you add the extra
* columns and ignored fields, e.g.:
@snipe
snipe / harryPotterAliases
Created June 13, 2016 04:13 — forked from graceavery/harryPotterAliases
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@snipe
snipe / AppServiceProvider.php
Last active February 13, 2020 11:16
Validate email array in Laravel 5.2 wth custom validator
<?php
/**
* This service provider handles a few custom validation rules.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v3.0
*/
namespace App\Providers;
@snipe
snipe / DbmigrateController.php
Created February 13, 2016 07:12 — forked from oilop9000/DbmigrateController.php
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Lee Zhen Yong https://gist.github.com/bruceoutdoors/9166186 fork from Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table