Skip to content

Instantly share code, notes, and snippets.

Linux forever

Maurizio De Santis mdesantis

Linux forever
  • Treatwell
  • Taranto, Italy
View GitHub Profile
mdesantis /
Last active October 11, 2021 08:11 — forked from delameko/
Upgrading PostgreSQL from 9.6 to 10 on Ubuntu 16.04


Install Postgres 10, and then:

sudo pg_dropcluster 10 main --stop
sudo pg_upgradecluster 9.6 main
sudo pg_dropcluster 9.6 main
View rails_json_session.rb
# Hack to change the Rails cookie serializer from Marshal to JSON and therefore allow the session
# to be shared between different languages but also avoid that someone knowing the
# cookie secret key could execute arbitrary code on the server by unmarshalling
# modified Ruby code added to the session/permanent cookie.
# Note that all users will beed to login again since both the remember me cookie and the session cookies
# won't be valid. Note also that the remember me cookie is tested multiple times per request even when it fails.
# for performance reasons you might want to delete it if these extra cycles are too costly for you.
# Rails 4 (not tested on Rails 3).
View rails_json_cookie_session_store.rb
mdesantis /
Last active March 21, 2018 13:18 — forked from romaimperator/
Unicorn init script; it uses start-stop-daemon and supports every Ruby version manager (RVM, rbenv, chruby...)
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn instances
# Description: starts the unicorn server instances using start-stop-daemon