Skip to content

Instantly share code, notes, and snippets.

View mrose17's full-sized avatar

Marshall T. Rose mrose17

  • Brave Software
  • Grand Cayman, KY
View GitHub Profile
@jperkin
jperkin / mdnschroot.sh
Last active December 27, 2019 05:56
Dynamically add/remove mDNSResponder chroot socket
#!/bin/bash
#
# This is an example script to dynamically update mDNSResponder on OSX to
# add/remove a chroot socket to enable DNS resolution inside it.
#
# If the chroot is not added, add it, otherwise delete it.
#
# You will probably want a more robust version for production.
#
@hardillb
hardillb / wemo-light.js
Last active November 3, 2016 08:08
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-light.js" for instructions
var wemo = require('wemo-js');
var http = require('http');
var util = require('util');
var xml2js = require('xml2js');
var postbodyheader = [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">',
'<s:Body>'].join('\n');
__block void(^block)(int) = ^(int i) {
printf("%d", i);
if (i > 0) {
block(i-1);
} else {
block = nil;
}
};
block(9);
@bnoordhuis
bnoordhuis / http-and-https-proxy.js
Created February 8, 2013 16:31
A node.js proxy that accepts HTTP and HTTPS traffic on the same port.
var fs = require('fs');
var net = require('net');
var http = require('http');
var https = require('https');
var httpAddress = '/path/to/http.sock';
var httpsAddress = '/path/to/https.sock';
fs.unlinkSync(httpAddress);
fs.unlinkSync(httpsAddress);