Skip to content

Instantly share code, notes, and snippets.

@taiar
taiar / rails_error.log
Created October 8, 2018 13:44
Daily rails error
-- Control frame information -----------------------------------------------
c:0118 p:---- s:0618 e:000617 CFUNC :binding
c:0117 p:0015 s:0615 e:000612 BLOCK /home/taiar/.rvm/gems/ruby-2.3.1@gdce/gems/interception-0.5/lib/cross_platform.rb:68 [FINISH]
c:0116 p:---- s:0610 e:000609 IFUNC :name
c:0115 p:---- s:0608 e:000607 CFUNC :map
c:0114 p:0021 s:0605 E:001238 BLOCK (pry):2 [FINISH]
c:0113 p:---- s:0602 e:000601 CFUNC :map
c:0112 p:0022 s:0599 E:001360 METHOD /home/taiar/.rvm/gems/ruby-2.3.1@gdce/gems/activerecord-4.2.10/lib/active_record/relation/delegation.rb:46
c:0111 p:0008 s:0592 E:0016c0 EVAL (pry):2 [FINISH]
c:0110 p:---- s:0590 e:000589 CFUNC :eval
@taiar
taiar / redis-cli
Created September 27, 2018 00:38
redis-cli
127.0.0.1:6379> KEYS *
1) "stat:failed"
2) "stat:failed:2018-09-20"
3) "stat:processed:2018-09-20"
4) "session:f9addc837b5c277d61830ab9a88c2554"
5) "session:6b729722b9d5a067df8deca789985ff8"
6) "stat:processed"
127.0.0.1:6379> MGET session:6b729722b9d5a067df8deca789985ff8
1) "\x04\b{\tI\"\x10_csrf_token\x06:\x06EFI\"1ScYhf+3TFrhHAAp36Z4OzwXrzeaHqiTXaQFqTy5ZvMQ=\x06;\x00FI\"\x1dgoogle_recaptcha_invalid\x06;\x00FFI\"\x0faccount_id\x06;\x00Fi\x02\x19\x15I\"\x0fexpires_at\x06;\x00FU: ActiveSupport::TimeWithZone[\bIu:\tTime\rW\xa3\x1d\xc0f\x18\x97\x03\t:\rnano_numi\x1f:\rnano_deni\x06:\rsubmicro\"\a\x02`:\tzoneI\"\bUTC\x06;\x00FI\"\bUTC\x06;\x00TIu;\a\rW\xa3\x1d\xc0f\x18\x97\x03\t;\bi\x1f;\ti\x06;\n\"\a\x02`;\x0bI\"\bUTC\x06;\x00F"
127.0.0.1:6379>
@taiar
taiar / guid.sh
Created September 21, 2018 19:42
GUID bash
VAR=$(cat /proc/sys/kernel/random/uuid)
echo $VAR | xclip -selection clipboard
echo $VAR | xclip -i
echo $VAR
@taiar
taiar / terminator.config
Created January 17, 2018 15:23
terminator.config
[global_config]
title_inactive_bg_color = "#4C566A"
title_inactive_fg_color = "#D8DEE9"
title_receive_bg_color = "#8FBCBB"
title_receive_fg_color = "#2E3440"
title_transmit_bg_color = "#88C0D0"
title_transmit_fg_color = "#2E3440"
[keybindings]
[layouts]
[[default]]
@taiar
taiar / notify.sh
Created January 9, 2018 13:48
notifies when a command stop running
sleep 2 && notify-send "Summary" "Acabouuuu"; mplayer -endpos 00:00:04 ~/gemidao.mp3
@taiar
taiar / mysql.sql
Last active August 24, 2022 20:35
Size of mysql databases in GBs
SELECT table_schema "Database name",
sum( data_length + index_length ) / 1024 / 1024 /1024 "Database size in GB"
FROM information_schema.TABLES
GROUP BY table_schema;
@taiar
taiar / simplesamlphp.php
Created December 11, 2017 13:40
simplesamlphp
<?php
// ...
if (!array_key_exists('PATH_INFO', $_SERVER)) {
throw new SimpleSAML_Error_BadRequest('Missing authentication source ID in assertion consumer service URL');
}
$sourceId = 'okta_login';// substr($_SERVER['PATH_INFO'], 1);
$source = \SimpleSAML_Auth_Source::getById($sourceId, 'sspmod_saml_Auth_Source_SP');
@taiar
taiar / cartesian.php
Created October 25, 2017 15:58
Cartesian product
<?php
/**
* Returns the cartesian product (combinations without repetitions) of the
* elements of N arrays passed as parameters inside an array.
*
* @param $arrays array Set of arrays to be combined
* @return array Array with the combinations
*/
function cartesianProduct($arrays)
@taiar
taiar / connect-heroku-app-to-postgres-rds-with-ssl.md
Created August 4, 2017 17:45 — forked from glarrain/connect-heroku-app-to-postgres-rds-with-ssl.md
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

@taiar
taiar / unimed.rb
Created March 19, 2017 18:55
Faz download da nota fiscal da unimed do mês atual
require 'rubygems'
require 'capybara'
require 'capybara/poltergeist'
require 'capybara/dsl'
require 'selenium/webdriver'
require 'byebug'
require 'cgi'
require 'timeout'
require 'open-uri'