See https://github.com/rbenv/ruby-build/wiki
Assuming rbenv and ruby-build already setup
brew install openssl libyaml libffi readline
# required for building Ruby <= 1.9.3-p0:
brew tap homebrew/dupes && brew install apple-gcc42
addEventListeners = (elem, events, callback) -> | |
events.split(' ').forEach (event) -> | |
elem.addEventListener event, callback, false |
# HH:17:30 ... HH:27:30 => HH:20:00 | |
def norm_time t | |
i = t.to_i | |
i /= 300.0 | |
i = i.round # round to nearest 5 minutes | |
i /= 2 # floor to nearest 10 minutes | |
Time.at i*600 | |
end | |
s = Time.now |
$ ./configure --help | |
`configure' configures this package to adapt to many kinds of systems. | |
Usage: ./configure [OPTION]... [VAR=VALUE]... | |
To assign environment variables (e.g., CC, CFLAGS...), specify them as | |
VAR=VALUE. See below for descriptions of some of the useful variables. | |
Defaults for the options are specified in brackets. |
(function(chars, index) { | |
for (chars = index = 0; index < localStorage.length; index++ ) | |
chars += localStorage.getItem(localStorage.key(index)).length | |
return `${(chars/1024/1024).toPrecision(5)} MB ≈${(chars/5/1024/1024*100).toPrecision(3)}%` | |
})() |
See https://github.com/rbenv/ruby-build/wiki
Assuming rbenv and ruby-build already setup
brew install openssl libyaml libffi readline
# required for building Ruby <= 1.9.3-p0:
brew tap homebrew/dupes && brew install apple-gcc42
#!/bin/bash | |
# | |
# !!! This function will attempt DOZENS of ssh connections !!! | |
# try not to scare your sysadmins | |
# | |
function collect_host_keys { | |
ukhf=$(mktemp) | |
keys="" |
# mod_rewrite method | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule /\.well-known/acme-challenge/(.+) http://example.com/cert-central/$1 [R=301,L] | |
</IfModule> | |
# mod_alias method | |
<IfModule mod_alias.c> | |
Alias "/.well-known/acme-challenge" "/var/acme-challenge" | |
<Directory "/var/acme-challenge"> |
# Thanks: https://github.com/dotgee/geoauth/blob/78e859b2d4ca5cd5788aeb3c3a64f2ccc92202dc/config/puma.god | |
ROOT = "/var/www/app/rails/development/geoauth" | |
God.pid_file_directory = "#{ROOT}/tmp/pids" | |
# rails_env = ENV['RAILS_ENV'] || 'production' | |
rails_env = ENV['RAILS_ENV'] || 'development' | |
rails_root = ENV['RAILS_ROOT'] || ROOT |
#!/bin/bash | |
# | |
# WARNING | |
# | |
# This script does not "work". It does correctly upate the preferences (good syntax). | |
# However, those settings are not reloaded until the user logs in again. | |
# They do NOT apply to the current session, and I haven't been able to find anything that | |
# can reload these values, other than AppleScript (with Accessability) simulating user input | |
# to the System Preferences application. | |
# |
""" | |
Port the to_base/from_base functions from Ruby to Python | |
""" | |
from __future__ import division | |
def __to_base_notation(value, base): | |
result = [] | |
while value > 0 or not len(result): | |
part = value % base | |
value = (value - part) / base |