Skip to content

Instantly share code, notes, and snippets.

@bruz
bruz / decrypt.rb
Created April 20, 2017 20:39
Decrypt Rails 4 session cookie
# `cookie` is the session cookie string
message = URI.unescape cookie
config = Rails.application.config
key_generator = ActiveSupport::KeyGenerator.new(
Rails.application.secrets.secret_key_base, iterations: 1000
)
secret = key_generator.generate_key(
config.action_dispatch.encrypted_cookie_salt
)
@bruz
bruz / 0_reuse_code.js
Created July 15, 2016 19:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am bruz on github.
  • I am bruz (https://keybase.io/bruz) on keybase.
  • I have a public key whose fingerprint is 23FA 06C9 7662 402B 0F9B 3386 B4B2 EA97 B335 45BB

To claim this, I am signing this object:

var g = require('./lib/garcon'),
server = new g.Server(),
myApp;
myApp = server.addApp({
name: 'signup',
//theme: 'my_theme',
buildLanguage: 'english'
});