mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Ensure that pathogen.vim ends up in ~/.vim/autoload
mkdir ~/.vim/colors
# Ruby Read File By Line | |
WORKING_DIR = File.dirname(__FILE__) | |
File.foreach(WORKING_DIR + '/filename.txt') do |line| | |
puts line | |
end | |
# The file can be online too | |
require 'open-uri' |
Describe Table: | |
PRAGMA table_info(tablename); | |
Show Tables: | |
.tables | |
sudo apt-get install jeweler | |
jeweler gem_name --testunit | |
cd gem_name | |
touch lib/gem_name.rb <unless you already have code, in which case move it to /lib> | |
rake version:write |
mkdir wpgskeeter | |
cd wpgskeeter | |
git init | |
heroku create wpgskeeter | |
git add . | |
git commit -m 'Initial commit' | |
Create a .gems file: | |
sinatra | |
nokogiri |
conf.return_format = '' |
rails new httpdocs --database=mysql | |
Config the db in config/database.yaml | |
Create subversion repos location: | |
svnadmin create /var/svn/n3repos | |
Import the rails project. |
# Example of using Mechanize to login to the RBC online banking. | |
# RBC has since changed the structure of their HTML, so I doubt this script still works. | |
require 'rubygems' | |
require 'hpricot' | |
require 'mechanize' | |
WWW::Mechanize.html_parser = Hpricot | |
agent = WWW::Mechanize.new | |
page = agent.get('https://www1.royalbank.com/cgi-bin/rbaccess/rbunxcgi?F6=1&F7=IB&F21=IB&F22=IB&REQUEST=ClientSignin&LANGUAGE=ENGLISH') |
s = IO.read('code.txt') | |
shift = ('e'.ord - ('a'..'z').reduce(['',0]) do |m, l| | |
s.count(l) > m[1] ? [l, s.count(l)] : m | |
end[0].ord) % 26 | |
puts s.tr('a-z', (('a'..'z').to_a*2)[shift...shift+26].join) | |
# Assumptions: | |
# | |
# - The plaintext is written in a language that uses Roman characters. | |
# - The plaintext is written in a language where 'e' is the most common letter. |
rwpeitg x. sdlc iwt gpqqxi-wdat | |
paxrt lph qtvxccxcv id vti ktgn ixgts du hxiixcv qn wtg hxhitg dc iwt | |
qpcz, pcs du wpkxcv cdiwxcv id sd: dcrt dg ilxrt hwt wps ettets xcid iwt | |
qddz wtg hxhitg lph gtpsxcv, qji xi wps cd exrijgth dg rdcktghpixdch xc | |
xi, 'pcs lwpi xh iwt jht du p qddz,' iwdjvwi paxrt 'lxiwdji exrijgth dg | |
rdcktghpixdc?' | |
hd hwt lph rdchxstgxcv xc wtg dlc bxcs (ph ltaa ph hwt rdjas, udg iwt | |
wdi spn bpst wtg utta ktgn hatten pcs hijexs), lwtiwtg iwt eatphjgt |