This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT count(*) FROM activepropertylist; | |
# Get count of EAN hotels by country | |
SELECT country, count(*) FROM activepropertylist GROUP BY country; | |
# Get total hotels by city | |
SELECT count(*) FROM activepropertylist WHERE city="New York" AND stateprovince="NY" | |
SELECT * from pointsofinterestcoordinateslist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
mysql -e "DROP DATABASE $2;" | |
mysql -e "CREATE DATABASE $2;" | |
for i in $(mysql -Ns $1 -e "show tables");do | |
echo "$1.$i -> $2.$i" | |
mysql -e "rename TABLE $1.$i to $2.$i" | |
done | |
mysql -e "DROP DATABASE $1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multi-AZ deployment | |
- Standby instance in another availability zone than the primary DB instance | |
- Use synchronous replication. | |
- Maintenance, backups etc. happens on standby instance to reduce any IO overhead. | |
- Can’t access standby instance for reads etc. | |
Read Replicas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Good call on not using default scopes. Github had an email incidence where Arel scopes and where didn't work well together - https://github.com/blog/1440-today-s-email-incident | |
Also, your advice on avoiding read replicas (caching/latency) for billing is spot on. Twilio recently had a billing incident due to something similar. - http://www.twilio.com/blog/2013/07/billing-incident-post-mortem-breakdown-analysis-and-root-cause.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n case of conflict, git rebase will stop at the first problematic commit and leave conflict markers in the tree. You can use git diff to locate the markers (<<<<<<) and make edits to resolve the conflict. For each file you edit, you need to tell Git that the conflict has been resolved, typically this would be done with | |
git add <filename> | |
After resolving the conflict manually and updating the index with the desired resolution, you can continue the rebasing process with | |
git rebase --continue | |
Alternatively, you can undo the git rebase with | |
git rebase --abort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I could think of following ways this was possible: | |
1. Perhaps you imported your email address book in the past which Twitter cached. and now that your friend joined, they sent you an email (or may be your friend imported their address book) | |
This was the main motivation behind Facebook acquisition of Octazen I believe. http://techcrunch.com/2010/02/19/octazen-what-the-heck-did-facebook-just-buy-exactly-and-why/ | |
2. Some signals indicating that you may know each other - your friend visiting your profile often. near by location. http://data.linkedin.com/projects/pymk 3. http://lifehacker.com/5911389/twitter-is-tracking-you-on-the-web-heres-what-you-can-do-to-stop-it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script "install wkhtmltoimage" do | |
interpreter "bash" | |
code "curl http://wkhtmltopdf.googlecode.com/files/wkhtmltoimage-0.10.0_rc2-static-amd64.tar.bz2 | bunzip2 - | tar xvf -; mv wkhtmltoimage-amd64 wkhtmltoimage" | |
action :run | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute "add-sphinx-version-to-emerge-list" do | |
command %Q{ | |
emerge --sync | |
echo "=app-misc/sphinx-0.9.9" >> /etc/portage/package.keywords/ec2 | |
} | |
not_if "cat /etc/portage/package.keywords/ec2 | grep app-misc/sphinx-0.9.9" | |
end | |
package "app-misc/sphinx" do | |
version "0.9.9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#unicorn_custom.rb.erb | |
working_directory '/data/<%= @app %>/current/' | |
worker_processes <%= @unicorn_worker_count %> | |
listen '/var/run/engineyard/unicorn_<%= @app %>.sock', :backlog => <%= @unicorn_worker_count * 1024 %> | |
timeout 60 | |
pid "/var/run/engineyard/unicorn_<%= @app %>.pid" | |
# Based on http://gist.github.com/206253 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNICORN_CONF="/data/<%= @app %>/shared/config/unicorn_custom.rb" | |
# GC Tuning | |
RUBY_GC_MALLOC_LIMIT=60000000;export RUBY_GC_MALLOC_LIMIT | |
# Set the malloc to 60mb | |
RUBY_HEAP_MIN_SLOTS=3500000;export RUBY_HEAP_MIN_SLOTS | |
# Rails in general takes 250k slots by default. | |
RUBY_HEAP_SLOTS_GROWTH_FACTOR=3;export RUBY_HEAP_SLOTS_GROWTH_FACTOR | |
RUBY_HEAP_SLOTS_INCREMENT=250000;export RUBY_HEAP_SLOTS_INCREMENT |
NewerOlder