Skip to content

Instantly share code, notes, and snippets.

View nicjansma's full-sized avatar

Nic Jansma nicjansma

View GitHub Profile
@nicjansma
nicjansma / MountVHD.cmd
Created January 5, 2012 02:28
MountVHD and UnMountVHD: Allows you to mount .VHDs in Windows 7 from the command-line. http://nicj.net/2012/01/04/mounting-vhds-in-windows-7-from-a-command-line-script
@echo off
setlocal enabledelayedexpansion
if {%1}=={} (
echo Usage: %~nx0 [vhd] [letter]
exit /b 1
)
set vhdPath=%~dpnx1
set driveLetter=%2
@nicjansma
nicjansma / check-apache-access-log-spammers.sh
Created January 25, 2012 04:19
Auto-ban website spammers via the Apache access_log
#!/bin/bash
#
# Config
#
# if more than the threshold, the IP will be banned
THRESHOLD=100
# search this many recent lines of the access log
@nicjansma
nicjansma / PngOutBatch.cmd
Created May 16, 2012 01:47
Runs a PNG through PngOut multiple times at different block sizes. Shows the file-size savings during and at the end. More details @ http://nicj.net/2012/05/15/pngoutbatch
@echo off
setlocal enabledelayedexpansion
REM
REM PngOutBatch
REM
REM Nic Jansma - nic@nicj.net
REM
REM Runs a PNG through PngOut multiple times at different block sizes. Shows the
REM file-size savings during and at the end.
@nicjansma
nicjansma / ie8-date-now-support.js
Last active December 11, 2015 21:58
Adds Date.now() support for IE <= 8
if (!Date.now) {
Date.now = function() {
return new Date().valueOf();
}
}
@nicjansma
nicjansma / ie89-console-apply-support.js
Created January 29, 2013 17:42
Adds .apply() and .call() support to IE8/9's console object, which treates .log()/etc as Objects and not Functions. Requires jQuery for $.each().
if (Function.prototype.bind && typeof console == "object" && typeof console.log == "object") {
var logFns = ["log", "info", "warn", "error", "assert", "dir", "clear", "profile", "profileEnd"];
$.each(logFns, function (i, method) {
console[method] = Function.prototype.call.bind(console[method], console);
});
}
@nicjansma
nicjansma / Keybase.md
Last active November 20, 2017 01:45
Keybase Proof

Keybase proof

I hereby claim:

  • I am nicjansma on github.
  • I am nicj (https://keybase.io/nicj) on keybase.
  • I have a public key ASDmvrFSwHxuJExmJfUoAyj8hLpx7-hKaa83bHOg-hu5oAo

To claim this, I am signing this object:

@nicjansma
nicjansma / boomerang-xhr-whitelist.js
Last active September 5, 2017 20:36
Boomerang AutoXHR Whitelist (requires 1.420 or later)
/**
* Boomerang XHR whitelist
*/
function addWhitelistFilter() {
if (window.BOOMR &&
window.BOOMR.version &&
window.BOOMR.plugins &&
window.BOOMR.plugins.AutoXHR &&
typeof BOOMR.plugins.AutoXHR.addExcludeFilter === "function") {
@nicjansma
nicjansma / boomerang-waitformark-plugin.js
Last active April 20, 2022 13:21
Boomerang plugin that waits for the specified UserTiming Mark (or Measure) to exist on the page before a beacon is sent.
/**
* The `WaitForMark` Boomerang plugin waits for the specified UserTiming Mark
* (or Measure) to exist on the page before a beacon is sent.
*
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon
* until the Mark exists. This allows the beacon to contain additional
* ResourceTiming data and other metrics/timers that might happen after page load.
*
* NOTE: Any plugin like this that delays a beacon from being sent after onload
* will have an effect on total number of beacons captured (due to the visitor
@nicjansma
nicjansma / boomerang-waitforjsvar-plugin.js
Last active April 20, 2022 13:20
Boomerang plugin that waits for the specified JavaScript variable to exist on the page before a beacon is sent.
/**
* The `WaitForJsVar` Boomerang plugin waits for the specified JavaScript variable
* to exist on the page before a beacon is sent.
*
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon
* until the variable exists. This allows the beacon to contain additional
* ResourceTiming data and other metrics/timers that might happen after page load.
*
* NOTE: Any plugin like this that delays a beacon from being sent after onload
* will have an effect on total number of beacons captured (due to the visitor
@nicjansma
nicjansma / boomerang-duplicate-custom-timers-to-beacon.js
Last active April 20, 2022 13:20
Boomerang plugin that duplicates any mPulse Custom Timers that are logged in the beacon's t_other parameter into distinct beacon parameters
/**
* The `DuplicateTimersToBeacon` Boomerang plugin duplicates any mPulse Custom Timers
* that are logged in the beacon's `t_other` parameter into distinct beacon parameters.
*
* e.g:
*
* t_other=boomerang|17,boomr_fb|2516,boomr_ld|2351,boomr_lat|165,custom5|2112,custom0|27
*
* Will add two more beacon parameters:
*