Skip to content

Instantly share code, notes, and snippets.

View jamescarr's full-sized avatar
🎯
Focusing

James Carr jamescarr

🎯
Focusing
View GitHub Profile
"well that's just great... those creatures will probably die out now from eating all that extraterrestrial bacteria from Earth" :)
@jamescarr
jamescarr / foo.js
Last active December 31, 2015 16:49
var url = 'https://zapier.com/hooks/catch/n/oyya3/'
$.ajax({
type: 'POST',
url: url,
data: {name: 'The Dude'},
contentType: "application/json",
dataType: 'jsonp',
success: function(json) {
console.dir(json);
},
# put the file on the server
file { '/tmp/something.deb':
source => 'puppet:///debs/elasticsearch-0.20.6.deb',
}
# or to install as a package!
package { 'elasticsearch':
source => 'puppet:///debs/elasticsearch-0.20.6.deb',
}
Linux 3.8.0-32-generic #47-Ubuntu SMP Tue Oct 1 22:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
@jamescarr
jamescarr / async.js
Last active December 27, 2015 11:49
function parseThatXML(content, rootElement) {
var result = {}, $el = $(content).find(rootElement);
$el.children().each(function() {
result[this.nodeName] = $(this).text();
});
return result;
}
var Zap = {
FROM shykes/nodejs
MAINTAINER James R. Carr <james.r.carr@gmail.com>
ADD ssl/client* /srv/app/ssl
ADD package.json /srv/app/package.json
ADD app.coffee /srv/app/app.coffee
RUN cd /srv/app && npm install .
CMD cd /srv/app && npm start
https = require 'https'
fs = require 'fs'
options =
host: 172.42.1.62
port: 4242
method: 'GET'
path: '/containers/json'
key: fs.readFileSync('ssl/client.key')
cert: fs.readFileSync('ssl/client.crt')
# Is normal http traffic denied?
curl -v http://localhost:4242/info
# How about https, sans client cert and key?
curl -v -s -k https://localhost:4242/info
# And the final good request!
curl -v -s -k --key client.key --cert client.crt https://localhost:4242/info
# Create the CA Key and Certificate for signing Client Certs
openssl genrsa -des3 -out ca.key 4096
openssl rsa -in ca.key -out ca.key # remove password!
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
# Create the Server Key, CSR, and Certificate
openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key # remove password!
openssl req -new -key server.key -out server.csr
upstream docker {
server unix:/var/run/docker.sock fail_timeout=0;
}
server {
listen 4242;
server localhost;
ssl on;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;