I'm in a hospital in Spain and my MacBook was stolen.
Now I bought a new one and need to configure it. I have an external hard drive that backup everything using Time Machine, but I don't want all the crap I had in the old one.
I'm in a hospital in Spain and my MacBook was stolen.
Now I bought a new one and need to configure it. I have an external hard drive that backup everything using Time Machine, but I don't want all the crap I had in the old one.
# Generate Private Key | |
$ openssl genrsa -out server.key 2048 | |
# Generate CSR | |
$ openssl req -new -out server.csr -key server.key -config openssl.cnf | |
# => Fill in info | |
# Check CSR | |
$ openssl req -text -noout -in server.csr | |
# Sign Cert | |
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt -extensions v3_req -extfile openssl.cnf |
var $ = function (d) { | |
var $ = document.querySelectorAll.bind(document); | |
Element.prototype.on = Element.prototype.addEventListener; | |
NodeList.prototype.on = function (event, fn) { | |
[].forEach.call(this, function (el) { | |
el.on(event, fn, false); | |
}); | |
}; | |
Installs ruby-2.0.0-p0 on ubuntu via checkinstall so it's in your package manager and you can remove it.
Quick install:
curl -Lo- https://gist.github.com/Sfate/5535586/raw/install-ruby-2-ubuntu.sh | bash
# Script for installing tmux 1.7 | |
# | |
# Installation: | |
# $ curl -Lo- http://git.io/tmux-1.7_install.sh | bash | |
# Find me here: | |
# https://gist.github.com/4510955 | |
# exit on error | |
set -e |
var playSingleChime = function() | |
{ | |
var context = new webkitAudioContext(), | |
gain = context.createGainNode(), | |
osc = context.createOscillator(); | |
osc.connect(gain); | |
gain.connect(context.destination); | |
osc.frequency.value = 1000.0; |
# encoding: UTF-8 | |
Capistrano::Configuration.instance(:must_exist).load do | |
namespace :rails do | |
desc "Open the rails console on one of the remote servers" | |
task :console, :roles => :app do | |
hostname = find_servers_for_task(current_task).first | |
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
end | |
end |
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Returns the result of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |