Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }
@pablosalgadom
pablosalgadom / restore_mac_trash.pl
Created November 13, 2017 12:59 — forked from cpq/restore_mac_trash.pl
MacOS: restore all files from Trash folder to their original location
#!/usr/bin/env perl
# Copyright (c) 2015 Sergey Lyubka
# All rights reserved
use Encode;
my $dir = "/Users/$ENV{USER}/.Trash";
sub read_file($) { local $/; open FD, $_[0] or die $_[0]; binmode FD; <FD>; }
@pablosalgadom
pablosalgadom / secret_key_base
Last active March 11, 2022 18:17
app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)
So i was using Rails 4.1 with Unicorn v4.8.2 and when i tried to deploy my app it doesn't start properly and into the unicorn.log file i found this error message:
"app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)"
After a little research i found that Rails 4.1 change the way to manage the secret_key, so if we read the secrets.yml file located at exampleRailsProject/config/secrets.yml (you need to replace "exampleRailsProject" for your project name) you will find something like this:
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@pablosalgadom
pablosalgadom / ruby.log
Created September 29, 2014 05:21
Ruby Segmentation Fault - Attempting to run $ RAILS_ENV=production rake db:create
$ RAILS_ENV=production rake db:create
/usr/local/rvm/gems/ruby-2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0052 p:---- s:0189 b:0189 l:000188 d:000188 CFUNC :initialize
c:0051 p:---- s:0187 b:0187 l:000186 d:000186 CFUNC :new
c:0050 p:0020 s:0183 b:0183 l:000182 d:000182 METHOD /usr/local/rvm/gems/ruby-2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888
c:0049 p:0119 s:0179 b:0179 l:000178 d:000178 METHOD /usr/local/rvm/gems/ruby-2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:568
c:0048 p:---- s:0172 b:0172 l:000171 d:000171 FINISH