Skip to content

Instantly share code, notes, and snippets.

View rafaelsales's full-sized avatar
💻
Compiling...

Rafael Sales rafaelsales

💻
Compiling...
View GitHub Profile
@rafaelsales
rafaelsales / ssh config file for Amazon EC2
Created January 12, 2013 22:01
Easier SSH-ing to Amazon EC2 instances. With this example, you can just do $ ssh my-webserver
Host my-webserver
HostName ec2-##-###-##-##.location-east-1.compute.amazonaws.com
User ec2-user
IdentityFile /path_to/private_key.pem
loop do
begin
sleep 1
rescue Exception => e
puts "I'm STRONGER. Give up!"
end
end
# Run and try CTRL+C
@rafaelsales
rafaelsales / indexes_not_in_use.sql
Last active August 29, 2015 14:11
Postgres check indexes statistics
SELECT
relid::regclass AS table,
indexrelid::regclass AS index,
pg_size_pretty(pg_relation_size(indexrelid::regclass)) AS index_size,
idx_tup_read,
idx_tup_fetch,
idx_scan
FROM
pg_stat_user_indexes
JOIN pg_index USING (indexrelid)
@rafaelsales
rafaelsales / search.sh
Created September 2, 2014 15:55
Search and Replase
LC_ALL=C find . -type f -exec sed -i '' 's/search/replace/g' {} +
@rafaelsales
rafaelsales / email.rb
Created June 11, 2014 12:44
Rails send email
ActionMailer::Base.mail(to: "your_email@provider.com", from: "from@provider.com", subject: "Test", body: "Test", ).deliver!
<DT><H3 FOLDED>iPhones</H3>
<DL><p>
<DT><A HREF="javascript:open(location,'iPhone:portrait','innerWidth='+(640+15)+',innerHeight='+(1136+15)+',scrollbars=yes');">iPhone 5 - Portrait</A>
<DT><A HREF="javascript:open(location,'iPhone:landscape','innerWidth='+(1136+15)+',innerHeight='+(640+15)+',scrollbars=yes');">iPhone 5 - Landscape</A>
<DT><A HREF="javascript:open(location,'iPhone:portrait','innerWidth='+(640+15)+',innerHeight='+(960+15)+',scrollbars=yes');">iPhone 4 - Portrait</A>
<DT><A HREF="javascript:open(location,'iPhone:landscape','innerWidth='+(960+15)+',innerHeight='+(640+15)+',scrollbars=yes');">iPhone 4 - Landscape</A>
<DT><A HREF="javascript:open(location,'iPhone:portrait','innerWidth='+(320+15)+',innerHeight='+(480+15)+',scrollbars=yes');">iPhone 3 - Portrait</A>
<DT><A HREF="javascript:open(location,'iPhone:landscape','innerWidth='+(480+15)+',innerHeight='+(320+15)+',scrollbars=yes');">iPhone 3 - Landscape</A>
<DT><A HREF="http://www.iphoneresolution.com/">What's the iPhone Screen Resolut