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 / goatse
Created March 14, 2013 08:03
Goatse ASCII art that won't break your W3C validation. (The original used double-hyphens inside the HTML comment, which would not validate.)
<!--
* * * * * * * * * * * * * * * * * * * * * * * * *
* *
* / \ \ / \ *
*| | \ | | *
*| `. | | : *
*` | | \| | *
* \ | / / \\\ ____ \\ : *
* \ \/ ___~~ ~____| \ | *
* \ \__~ ~__\ | *
@snipe
snipe / gist:5512408
Created May 3, 2013 18:25
ASCII Goatse
* g o a t s e x * g o a t s e x * g o a t s e x *
g g
o / \ \ / \ o
a| | \ | | a
t| `. | | : t
s` | | \| | s
e \ | / / \\\ --__ \\ : e
x \ \/ _--~~ ~--__| \ | x
* \ \_-~ ~-_\ | *
g \_ \ _.--------.______\| | g
@snipe
snipe / gist:4256150
Created December 11, 2012 05:38
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Symfony2
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="My Symfony2 Project" default="build">
<target name="build"
depends="prepare, vendors, dbupdate, fixtures, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare, vendors, dbupdate, fixtures, lint, tools-parallel, phpcpd, phpunit"/>
<?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 / rss_img_ripper.php
Last active July 28, 2023 14:00
Quick and dirty script to download thumbnail and fullsize images from RSS feed. The RSS feed can be remote, but this was a one-off I needed to throw together, so I just downloaded the RSS feed to my local drive.
<?php
$feed = 'recent.rss';
$xml = new SimpleXMLElement(file_get_contents($feed));
$xml->registerXPathNamespace('media', $feed);
$images = $xml->xpath('/rss/channel/item/media:content/@url');
foreach ( $xml->channel->item as $item ) {
$namespaces = $item->getNameSpaces(true);
$media = $item->children($namespaces['media']);
@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 / asia-block.htaccess
Created February 25, 2013 11:01
Block asian traffic. :( SItes are getting slammed with bad bots and spammers.
<Files *>
order deny,allow
# Cambodia (KH)
deny from 114.134.184.0/21
# Chinese (CN) IP addresses follow:
deny from 1.192.0.0/13 1.202.0.0/15 14.144.0.0/12 14.208.0.0/12 27.8.0.0/13 27.16.0.0/12 27.36.0.0/14 27.40.0.0/13 27.54.192.0/18 27.106.128.0/18 27.115.0.0/17 27.152.0.0/13 27.184.0.0/13 36.248.0.0/14 58.16.0.0/15 58.20.0.0/16 58.21.0.0/16 58.22.0.0/15 58.34.0.0/16 58.37.0.0/16 58.38.0.0/16 58.40.0.0/16 58.42.0.0/16 58.44.0.0/14 58.48.0.0/13 58.56.0.0/15 58.58.0.0/16 58.59.0.0/17 58.60.0.0/14 58.68.128.0/17 58.82.0.0/15 58.100.0.0/15 58.208.0.0/12 58.242.0.0/15 58.246.0.0/15 58.248.0.0/13 59.32.0.0/13 59.40.0.0/15 59.42.0.0/16 59.44.0.0/14 59.51.0.0/16 59.52.0.0/14 59.56.0.0/13 59.72.0.0/16 59.108.0.0/15 59.174.0.0/15 60.0.0.0/13 60.11.0.0/16 60.12.0.0/16 60.24.0.0/13 60.160.0.0/11 60.194.0.0/15 60.208.0.0/13 60.216.0.0/15 60.220.0.0/14 61.4.64.0/20 61.4.80.0/22 61.4.176.0/20 61.48.0.0/13 61.128.0.0/10 61.135.0.0/16 61.136.0.0/18 61.139.0.0/16 61.145.73.208/28 61.147.0.0/16 61.152.0.0/16 61.160.0.0/16
@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:aee3b4f5793cfe0c3d39
Created March 6, 2015 07:56
Laravel Artisan command to upload fils to S3 with cache-control headers
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class MoveToS3 extends Command {
/**
* The console command name.