Skip to content

Instantly share code, notes, and snippets.

View jhancock's full-sized avatar

Jon Hancock jhancock

  • http://shellshadow.com
  • Wellington, New Zealand
View GitHub Profile
#########################
## SSL for dev ##
#########################
openssl genrsa -des3 -passout pass:x -out dev.mydomain.pass.key 2048
openssl rsa -passin pass:x -in dev.mydomain.pass.key -out dev.mydomain.key
rm dev.mydomain.pass.key
server {
listen 80;
listen 443 ssl;
server_name www.mydomain.com;
access_log /var/log/nginx/mydomain.access.log;
error_log /var/log/nginx/mydomain.error.log;
## SSL setting reference:
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@jhancock
jhancock / gist:a77c3edd29a59483b325
Created September 29, 2014 13:27
phoenix docs error
jhancock@air:~/phoenix$ MIX_ENV=docs mix run release_docs.exs
==> ex_doc
warning: the dependency ex_doc requires Elixir "~> 0.15.0" but you are running on v1.0.0
Compiled lib/ex_doc/cli.ex
Compiled lib/ex_doc/markdown.ex
Compiled lib/ex_doc.ex
Compiled lib/ex_doc/markdown/earmark.ex
Compiled lib/ex_doc/markdown/hoedown.ex
Compiled lib/ex_doc/markdown/pandoc.ex
@jhancock
jhancock / error-log-tail
Created November 21, 2012 04:32
rvm install 1.9.1 error
mhd@lu:~$ tail /home/mhd/.rvm/log/ruby-1.9.1-p431/make.log
ossl_ssl.c:109:5: warning: (near initialization for ‘ossl_ssl_method_tab[10].func’) [enabled by default]
ossl_ssl.c:110:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:110:5: warning: (near initialization for ‘ossl_ssl_method_tab[11].func’) [enabled by default]
ossl_ssl.c: In function ‘ossl_sslctx_session_remove_cb’:
ossl_ssl.c:407:38: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
ossl_ssl.c: In function ‘ossl_ssl_get_cipher’:
ossl_ssl.c:1223:12: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/home/mhd/.rvm/src/ruby-1.9.1-p431/ext/openssl'
class Nginx < Thor
desc "start", "start nginx"
def start
`sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf`
end
desc "stop", "stop nginx"
def stop
nginx_pid_path = "/usr/local/nginx/logs/nginx.pid"
# `cat #{nginx_pid_path}`
# encoding: utf-8
require 'mongo'
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Connection::DEFAULT_PORT
puts "Connecting to #{host}:#{port}"
db = Mongo::Connection.new(host, port).db('jon')
coll = db.collection('test')
require 'rubygems'
require 'mongo'
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
port = ENV['MONGO_RUBY_DRIVER_PORT'] || Mongo::Mongo::DEFAULT_PORT
puts "Connecting to #{host}:#{port}"
db = Mongo::Mongo.new(host, port).db('jon')
coll = db.collection('test')
require 'rubygems'
require 'mongo'
require 'pp'
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
puts "Connecting to #{host}:#{port}"
db = XGen::Mongo::Driver::Mongo.new(host, port).db('blog_test')
articles = db.collection('articles')
require 'rubygems'
require 'mongo'
host = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
port = ENV['MONGO_RUBY_DRIVER_PORT'] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
puts "Connecting to #{host}:#{port}"
db = XGen::Mongo::Driver::Mongo.new(host, port).db('jon')
coll = db.collection('test')