This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__block void(^block)(int) = ^(int i) { | |
printf("%d", i); | |
if (i > 0) { | |
block(i-1); | |
} else { | |
block = nil; | |
} | |
}; | |
block(9); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |