Skip to content

Instantly share code, notes, and snippets.

function apt_download() {
PACKAGE=$1
URI=`apt-cache show $PACKAGE | grep "Filename:" | cut -f 2 -d " "`
wget http://archive.ubuntu.com/ubuntu/$URI
}
@PragmaticEd
PragmaticEd / puma_ssl.sh
Last active May 22, 2017 20:42
Run Puma server with https
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@PragmaticEd
PragmaticEd / Make downcase, upcase, capitalize methods work with non UNICODE characters (like Russian).md
Created July 28, 2016 12:38
Make downcase, upcase, capitalize methods work with non UNICODE characters (like Russian)
str = 'Привет'

puts str          # => Привет
puts str.downcase # => Привет

using active_support

require 'active_support/all' # not required inside Rails app
@PragmaticEd
PragmaticEd / Vagrantfile
Created July 21, 2016 13:22 — forked from spacegauch0/Vagrantfile
Vagrant config to setup a rvm + ruby + rails + passenger + nginx + mysql.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.hostname = "ruby-dev-server"
config.vm.provision :shell, path: "install.sh"