Skip to content

Instantly share code, notes, and snippets.

View jsmestad's full-sized avatar
👾

Justin Smestad jsmestad

👾
View GitHub Profile
@pasviegas
pasviegas / mongodb
Created March 27, 2010 01:26
Simple monit script for mongodb
check host mongodb with address localhost
start program = "/usr/bin/sudo /opt/database/mongo/bin/mongod"
stop program = "/usr/bin/sudo /usr/bin/pkill -f mongod"
if failed port 28017 protocol HTTP
request /
with timeout 10 seconds
then start
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@devver
devver / terms_of_service.markdown
Last active October 22, 2023 03:35
A general Terms of Service under the Creative Commons License

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.

@rodreegez
rodreegez / rails_tested.md
Created May 6, 2010 15:24
Hudson, Ruby Enterprise Edition, Nginx.

Testing Rails with Hudson CI

Written for Ubuntu LTS 10.4

Update and upgrade

  $ sudo aptitude update
  $ sudo aptitude upgrade
--- a/src/configure.in
+++ b/src/configure.in
@@ -993,11 +993,17 @@ AC_ARG_ENABLE(rubyinterp,
AC_MSG_RESULT($enable_rubyinterp)
if test "$enable_rubyinterp" = "yes"; then
AC_MSG_CHECKING(--with-ruby-command argument)
+ dnl If a ruby command was provided, set RUBY_CMD to the name of the binary and RUBY_PATH to its directory
AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
- RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
- RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
@thhermansen
thhermansen / carrierwave_tasks.rake
Created August 11, 2010 12:55 — forked from mrrooijen/carrierwave_tasks.rb
CarrierWave Amazon S3 reprosessor rake task
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory

m1.large

Iozone: Performance Test of File I/O
        Version $Revision: 3.308 $
  Compiled for 64 bit mode.
  Build: linux 

Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins

Al Slater, Scott Rhine, Mike Wisner, Ken Goss

m1.large

Single mounted EBS, XFS

Iozone: Performance Test of File I/O
        Version $Revision: 3.308 $
  Compiled for 64 bit mode.
  Build: linux

Run began: Sun Aug 22 19:35:33 2010

MongoDB Aggregation
Min and Max
db.posts.find({}).sort({x: 1}).limit(1) return the post with the smallest value for x
db.posts.find({}).sort({x: -1}).limit(1) return the post with the largest value for x
Note: min and max queries are most efficient with an index on the field being sorted on.
Count
db.posts.count(selector) count the number of posts matching the given selector
db.posts.count({}) count the total number of posts