Skip to content

Instantly share code, notes, and snippets.

View designermonkey's full-sized avatar

John Porter designermonkey

View GitHub Profile
@designermonkey
designermonkey / gist:89ecada4c5c0592d760f22923d71fa23
Created April 8, 2019 18:20 — forked from so0k/gist:cdd24d0a4ad92014a1bc
droplet discovery over digitalocean private networks

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu
@designermonkey
designermonkey / autossh.service
Created December 6, 2015 12:28 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@designermonkey
designermonkey / backbone.fetch.js
Created September 30, 2015 09:15 — forked from akre54/backbone.fetch.js
Backbone.ajax with window.fetch
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
return obj;
}
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {
@designermonkey
designermonkey / xml.xsl
Last active August 29, 2015 14:26 — forked from vdcrea/xml.xsl
xsl file to output xml used for unsa-industrie.org
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xls="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:string="http://www.getsymphony.com/functions"
exclude-result-prefixes="xls string">
<xsl:import href="../utilities/functions/function.string.utilities.xsl"/>
<xsl:output method="xml"
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
require 'formula'
class Phpunit < Formula
homepage 'http://www.phpunit.de/manual/current/en/index.html'
url 'https://phar.phpunit.de/phpunit.phar'
sha1 'dc693b34a62644f61cfc01a22d9654ff4b8764af'
version 'HEAD'
def install
bin.install "phpunit.phar" => "phpunit"
<?xml version="1.0" encoding="UTF-8"?>
<data>
<events>
<event>
<title>Recurring Exciting Event</title>
<date>2012-01-01</date>
<end-date>2014-12-31</end-date>
<recurring>yes</recurring>
<recurring-number>2</recurring-number>
<recurring-type>weeks</recurring-type>
<?xml version="1.0" encoding="UTF-8"?>
<data>
<products>
<entry id="1">
<name>Test</name>
<public-price>10.00</public-price>
<trade-price>8.00</trade-price>
</entry>
<entry id="2">
<name>Test</name>
<data>
<products>
<entry>one</entry>
<entry>two</entry>
<entry>three</entry>
<entry>four</entry>
<entry>five</entry>
<entry>six</entry>
<entry>seven</entry>
<entry>eight</entry>
<data>
<aspectratios>
<item name="onebyone">1</item>
<item name="onebytwo">0.5</item>
<item name="onebythree">0.33333</item>
<item name="twobyone">2</item>
<item name="twobythree">0.66667</item>
<item name="twobyfive">0.4</item>
<item name="threebyone">3</item>
<item name="threebytwo">1.5</item>