Skip to content

Instantly share code, notes, and snippets.

View mcgwiz's full-sized avatar
🛠️

Mike McGranahan mcgwiz

🛠️
View GitHub Profile
// Only add setZeroTimeout to the window object, and hide everything
// else in a closure.
(function() {
var timeouts = [];
var messageName = "zero-timeout-message";
// Like setTimeout, but only takes a function argument. There's
// no time argument (always zero) and no arguments (you have to
// use a closure).
function setZeroTimeout(fn) {
@cojocar
cojocar / tomato-static-mac.md
Last active July 1, 2020 16:22
Set a fixed MAC address on a TAP interface (OpenVPN client) on Tomato Firmware 1.28.0000 MIPSR2-101 K26 USB AIO-64K and maybe on others

How to set a fixed MAC address on a TAP interface (OpenVPN client) on Tomato Firmware

Problem

Using the lladdr 00:11:22:33:44:55 option in the OpenVPN client custom configuration form doesn't change the MAC of the tap interface.

Solution

Paste this in the custom configuration box:

script-security 2
@mcgwiz
mcgwiz / .gitattributes
Last active April 23, 2017 20:19
Super simple JavaScript git diff hunk header config
*.js diff="javascript"
@daveaugustine
daveaugustine / Inside_your_router.coffee
Created February 8, 2012 18:33
Super simple Google Analytics page tracking with backbone
initialize: ->
@bind 'all', @_trackPageview
_trackPageview: ->
url = Backbone.history.getFragment()
_gaq.push(['_trackPageview', "/#{url}"])
@SamSaffron
SamSaffron / gist:1599013
Created January 12, 2012 05:59
dapper.rainbow
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Dapper;
// to have a play, install Dapper.Rainbow from nuget
@zommarin
zommarin / Get-FileEncoding.ps1
Created December 15, 2011 12:43
Get-FileEncoding
function Get-FileEncoding($Path) {
$bytes = [byte[]](Get-Content $Path -Encoding byte -ReadCount 4 -TotalCount 4)
if(!$bytes) { return 'utf8' }
switch -regex ('{0:x2}{1:x2}{2:x2}{3:x2}' -f $bytes[0],$bytes[1],$bytes[2],$bytes[3]) {
'^efbbbf' { return 'utf8' }
'^2b2f76' { return 'utf7' }
'^fffe' { return 'unicode' }
'^feff' { return 'bigendianunicode' }