Skip to content

Instantly share code, notes, and snippets.

View Nowaker's full-sized avatar

Damian Nowak Nowaker

View GitHub Profile
@zimbatm
zimbatm / sd_daemon.rb
Last active February 8, 2017 15:48
A pure ruby implementation of the sd-daemon library distributed with SystemD
# A pure ruby implementation of the sd-daemon library distributed with SystemD.
#
# Includes:
# * File descriptor passing for socket-based activation
# * Daemon ready notifications
#
# Missing:
# * Watchdog notifications
# * Support for logging with log levels on stderr
# * Detection of systemd boots
@tamoyal
tamoyal / gist:10441108
Created April 11, 2014 04:39
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@speedmax
speedmax / ssl_requirement_spec.rb
Created July 9, 2013 06:22
How to test rack middleware
require 'spec_helper'
# Based on https://github.com/rails/ssl_requirement/blob/master/lib/ssl_requirement.rb
class SslRequirement
def initialize(app, options= {})
@app = app
@allowed = options[:allowed]
@required = options[:required]
end