Skip to content

Instantly share code, notes, and snippets.

#!/home/digilord/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
require 'rubygems'
require 'open-uri'
require 'nokogiri'
require 'action_mailer'
require 'active_support'
require 'yaml'
trap("SIGINT") { exit! }
:mail: # Parameters for GMail or Google Apps for your Domain
:smtp_server: smtp.gmail.com
:smtp_port: 587
:domain: example.com
:user_name: john.doe@example.com
:password: password
:authentication: plain
:enable_starttls_auto: true
:general:
@digilord
digilord / gist:7893351
Created December 10, 2013 16:20
Meteor & Munin Nginx Configuration with SSL
server {
listen 80;
server_name www.YOURDOMAIN.com;
# $scheme will get the http protocol
# and 301 is best practice for tablet, phone, desktop and seo
# return 301 $scheme://YOURDOMAIN.com$request_uri;
# We want to redirect people to the https site when they come to the http site.
return 301 https://YOURDOMAIN.com$request_uri;
}
@digilord
digilord / gist:7893496
Created December 10, 2013 16:30
localdeploy.sh for a Meteor app. This script assumes that you are using upstart scripts, nginx with SSL, and nodejs from http://ppa.launchpad.net/chris-lea/node.js/ubuntu
#!/bin/bash
function test {
"$@"
status=$?
if [ $status -ne 0 ]; then
echo "error with $1"
fi
return $status
}
APP_HOME=/home/meteor/myapp
Apache CouchDB 1.4.0 (LogLevel=info) is starting.
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/etc/couchdb/default.ini","/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,couch_primary_services,{shutdown,{failed_to_start_child,collation_driver,"cannot open shared object file: No such file or directory"}}}}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,269}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
Meteor.startup () ->
# Countries collection initialization.
countries_csv = Assets.getText('country.csv')
csv = Meteor.require('csv')
countries_count = Countries.find().count()
if countries_count is 0
Future = Npm.require('fibers/future')
future = new Future()
csv()
.from.string(countries_csv, {comment: '#'})
# Do we have swap?
grep swap /etc/fstab -q
status=$?
if [ $status -ne 0 ]; then
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
echo "/swapfile none swap sw 0 0" >> /etc/fstab
swapon /swapfile
fi
@digilord
digilord / publish_groups.js
Created December 23, 2013 23:40
Publish and subscribe that are reactive for groups
Meteor.publish('groups', function(group_id) {
return Groups.find({_id: group_id});
});
Meteor.startup () ->
# Countries collection initialization.
countries_csv = Assets.getText('country.csv')
csv = Meteor.require('csv')
countries_count = Countries.find().count()
if countries_count is 0
Future = Npm.require('fibers/future')
future = new Future()
csv()
.from.string(countries_csv, {comment: '#'})
{
"iconv":"2.0.7"
}