Skip to content

Instantly share code, notes, and snippets.

View nathan-muir's full-sized avatar

Nathan Muir nathan-muir

View GitHub Profile
#!/bin/sh
tc qdisc del dev eth0 root 2> /dev/null
if [ "z$1" = "zdialup" ] ; then
echo "Brace yourself, enabling dialup preset..."
BANDWIDTH=56kbit
LATENCY=200msec
elif [ "z$1" = "z2g" ] ; then
echo "Enabling 2G preset..."
#!/bin/bash
#
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT,
# in the amount of $DELAY.
#
# This is matching on both source port and destination port, which
# may hit you twice if you're accessing a local resource.
#
# To see what's currently in effect,
# tc -s qdisc show dev lo
@nathan-muir
nathan-muir / test-non-reactive-sort-1.html
Last active August 29, 2015 14:02
Meteor - non-reactive sort (with reactive data)
<head>
<title>test-non-reactive-sort-1</title>
</head>
<body>
{{> nonReactiveSort}}
</body>
<template name="nonReactiveSort">
Page: <a href="#" data-action="page" data-n="-1">Prev</a> | <a href="#" data-action="page" data-n="1">Next</a>
@nathan-muir
nathan-muir / test-non-reactive-sort-2.html
Last active August 29, 2015 14:02
Meteor - non-reactive sort (with reactive data) [Method 2]
<head>
<title>test-non-reactive-sort-2</title>
</head>
<body>
{{> nonReactiveSort}}
</body>
<template name="nonReactiveSort">
Page: <a href="#" data-action="page" data-n="-1">Prev</a> | <a href="#" data-action="page" data-n="1">Next</a>
@nathan-muir
nathan-muir / certs.sh
Created November 2, 2014 02:03
Create a self signed cert, without a password
openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem -days 5000
@nathan-muir
nathan-muir / inet.coffee
Created December 22, 2014 12:00
Inet.coffee
IP_ADDRESS_REGEX = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
CIDR_ADDRESS_REGEX = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/(\d{1,2})$/
class @Inet
constructor: (ipAddress)->
if typeof ipAddress == 'number'
@nathan-muir
nathan-muir / start-mongo.sh
Created February 24, 2015 01:52
start meteor mongo smallfiles
mongod --smallfiles --dbpath /path/to/my/app/.meteor/local/db --port 3001
@nathan-muir
nathan-muir / change-key-pw.sh
Created August 4, 2015 00:50
SSH - Change password on key file
ssh-keygen -p -f $1
ssh-add $1
@nathan-muir
nathan-muir / 01-connect.jsx
Last active January 28, 2016 07:18
Meteor - Connect
connect = function connect(observeable, ...selectors) {
return function (ChildComponent) {
const childDisplayName =
ChildComponent.displayName ||
ChildComponent.name ||
'ChildComponent';
return React.createClass({
displayName: `ConnectedObserver(${childDisplayName})`,
@nathan-muir
nathan-muir / routes.js
Created February 17, 2016 02:06 — forked from dearlordylord/routes.js
Iron Router error
var A = RouteController.extend({
onBeforeAction: function() {
console.warn('A');
this.next();
}
});
var B = A.extend({
onBeforeAction: function() {
console.warn('B');
this.next();