Skip to content

Instantly share code, notes, and snippets.

View rogeralbinoi's full-sized avatar
:octocat:
Good thinks take time

Roger Albino rogeralbinoi

:octocat:
Good thinks take time
View GitHub Profile
@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@db0sch
db0sch / regenerate_credentials.md
Last active July 30, 2024 12:59
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@rodrigopasc
rodrigopasc / nginx_with_passenger_and_pagespeed_on_ubuntu_pt.md
Last active March 10, 2020 17:22
Instalando nginx com os módulos Passenger e PageSpeed no Ubuntu [PT]

Instalar nginx com os módulos Passenger e PageSpeed

Português | English

Preparando

Bibliotecas essenciais

Você precisará garantir que as seguintes bibliotecas estão instaladas:

$ sudo apt-get -y update