Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
require 'rubygems' | |
require 'sinatra' | |
require 'fileutils' | |
# upload with: | |
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename | |
post '/:name/:filename' do | |
userdir = File.join("files", params[:name]) |
require 'rubygems' | |
require 'bcrypt' | |
require 'haml' | |
require 'sinatra' | |
enable :sessions | |
userTable = {} | |
helpers do |
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
r := mux.NewRouter() | |
// Single handler | |
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging) | |
// All handlers | |
http.Handle("/", recovery(r)) | |
// Sub-routers | |
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json} |
sudo yum -y install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git | |
sudo yum -y install wxBase.x86_64 | |
sudo yum -y install wget | |
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm | |
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm | |
sudo yum -y install esl-erlang | |
sudo mkdir /opt/elixir | |
sudo git clone https://github.com/elixir-lang/elixir.git /opt/elixir | |
cd /opt/elixir | |
sudo make clean test |
sudo touch /etc/init.d/couchdb | |
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
sudo dpkg -i erlang-solutions_1.0_all.deb | |
sudo apt-get update | |
sudo apt-get -y install elixir erlang-dev | |
rm erlang-solutions_1.0_all.deb |
# download latest libevent2 and tmux sources, and extract them somewhere | |
# | |
# at the time of writing: | |
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
# http://sourceforge.net/projects/tmux/files/latest/download?source=files | |
# | |
# don't compile tools as root, just don't do it. | |
# install deps |
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2' | |
inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2' | |
inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5' | |
inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5' | |
inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5' | |
inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5' |
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2' | |
inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2' | |
inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5' | |
inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5' | |
inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5' | |
inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5' |