On macOS the system python crashes with weird bugs.
You get around that using virtualenv and python 2.7
Here's what I did
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
class HTML5Uploader | |
constructor:(obj, options) -> | |
@method = options['method'] ||= "POST" | |
@url = options['url'] ||= "/" | |
@params = options['params'] | |
@obj = $(obj) | |
@files = [] | |
@alerted = false |
$("#media_items").html5Uploader({ | |
url: "<%= assets_path %>", | |
method: 'POST', | |
params: { | |
authenticity_token: "<%= form_authenticity_token %>" | |
} | |
}); |
run "rm Gemfile" | |
file 'Gemfile', <<-FILE | |
source 'http://rubygems.org' | |
gem 'rails', '3.0.3' | |
gem 'rake', '~> 0.8.7' | |
gem 'devise', '~> 1.2.0' | |
gem 'cancan' | |
gem 'will_paginate', '~> 3.0.pre2' | |
gem 'tzinfo' |
# Add a git user | |
adduser git | |
# Add your ssh key | |
sudo -u git mkdir ~git/.ssh/ | |
sudo cp id_rsa.pub ~git/.ssh/authorized_keys | |
sudo chown -R git.git ~git/.ssh | |
# Make a repo | |
sudo -u git mkdir ~git/MyRepo.git |
require "socket" | |
server = TCPServer.new('0.0.0.0', 6969) | |
loop do | |
socket = server.accept | |
Thread.start do | |
s = socket | |
# I cannot credit the original author | |
class Haversine | |
#EARTH_RADIUS = 3963.19 # miles | |
EARTH_RADIUS = 6371 # kilometers | |
RADIAN_PER_DEGREE = Math::PI / 180.0 | |
def self.distance(lat1, lng1, lat2, lng2) | |
lat1_radians = lat1 * RADIAN_PER_DEGREE | |
lat2_radians = lat2 * RADIAN_PER_DEGREE |