The best way to do this is probably via docker volumes. For dokku, check out dokku-persistent-storage
But here's a quick hack using netcat anyway.
Assuming we've found the container ID (e.g.: via docker ps
):
$ CID=f7a29d6dc8e4
The best way to do this is probably via docker volumes. For dokku, check out dokku-persistent-storage
But here's a quick hack using netcat anyway.
Assuming we've found the container ID (e.g.: via docker ps
):
$ CID=f7a29d6dc8e4
# via http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect | |
# http://mathworld.wolfram.com/Line-LineIntersection.html | |
getLineIntersection = (x1, y1, x2, y2, x3, y3, x4, y4) -> | |
s1_x = x2 - x1 | |
s1_y = y2 - y1 | |
s2_x = x4 - x3 | |
s2_y = y4 - y3 | |
s = (-s1_y * (x1 - x3) + s1_x * (y1 - y3)) / (-s2_x * s1_y + s1_x * s2_y) | |
t = (s2_x * (y1 - y3) - s2_y * (x1 - x3)) / (-s2_x * s1_y + s1_x * s2_y) |
# replace file basename with a UUID when uploaded | |
# e.g.: avatar.jpg becomes 41bf830f-80cf-4efe-ad90-3b29bc6708b5.jpg | |
# but don't regenerate a UUID each time file url is accessed | |
class User < ActiveRecord::Base | |
has_attached_file :avatar, path: ":basename.:extension" | |
before_validation { set_avatar_file_name } | |
def set_avatar_file_name | |
# replace any NEW filename with a UUID |
// A script to click each download button on this page: https://soundcloud.com/user48736353001/sets/all | |
// run it in the Developer Console in Chrome with the page open. | |
// Worked for me! ¯\_(ツ)_/¯ | |
// I still can't figure out how Metal Beat was recorded. It's INSANE. | |
list = document.getElementsByClassName('sc-button-download') | |
[].forEach.call(list, function(el) { | |
var evt = document.createEvent("MouseEvents") | |
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null) | |
el.dispatchEvent(evt) | |
}) |
# A demonstration of Ruby mixins, in response to: | |
# http://www.deftflux.net/blog/post/A-good-design-for-multiple-implementation-inheritance.aspx | |
module BarkingBehavior | |
def bark | |
puts "Bark!" | |
end | |
end | |
module MeowingBehavior |
#!/usr/bin/env ruby | |
# | |
# autoreload | |
# reload webkit whenever files in the current directory are modified | |
# | |
# requires: | |
# * RubyCocoa (bundled with Leopard) | |
# * gem install fsevents (http://github.com/ymendel/fsevents/tree/master) | |
# | |
require 'fsevents' |
// FormantTable demo in SuperCollider | |
// boot the server | |
s.boot; | |
// Saw freq is controlled by mouse X position | |
// BBandPass filter is controlled by | |
// FormantTable data (frequencies, resonances, amplitudes) | |
( | |
SynthDef(\formantVoice, { arg |
// "Laugh Track" -- an attempt at laugh synthesis | |
// For SuperCollider 3.2 -- requires FormantTable | |
( | |
#f, a, q = FormantTable.get(\altoA); | |
e = Env( | |
[ 1.6315789222717, 2.8684210777283, 0, 1.1526317596436, 0, 0.63157892227173, 0, 0, 0.39473664164831, 0.41710549016785, 0, 0.33685091589462, 0.3538348548878, 0, 0.10526323318481, 0 ], | |
[ 0.099179289557717, 0.029608596454967, 0.070896452123469, 0.015656579624523, 0.045265132730657, 0.08636364069852, 0.027344267630401, 0.021196740851856, 0.025568173912275, 0.020519098486223, 0.029819674626466, 0.025645296259773, 0.057419430367461, 0.18465909090909, 0.16357317837802 ] | |
); | |
w = SCWindow("Laugh Editor", Rect(200,200,400,300)); | |
v = SCEnvelopeEdit(w, w.view.bounds.moveBy(20,20).resizeBy(-40,-140), e, 20).resize_(5); |
// JSONP.Request for Prototype | |
// based on: http://github.com/kangax/protolicious/blob/master/get_json.js | |
JSONP = { count: 0 }; | |
JSONP.Request = Class.create({ | |
initialize: function(url, options) { | |
this.options = { | |
timeoutInSeconds: 5, | |
onSuccess: Prototype.emptyFunction, | |
onFailure: Prototype.emptyFunction | |
}; |
/* via http://www.simonwhatley.co.uk/ */ | |
Twitter = { | |
format: function(tweet) { | |
return Twitter.formatHashtag(Twitter.formatUsername(Twitter.formatURL(tweet))); | |
}, | |
formatURL: function(string) { | |
return string.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(url) { | |
return url.link(url); | |
}); | |
}, |