Skip to content

Instantly share code, notes, and snippets.

View rhiroyuki's full-sized avatar
🏠
Working from home

Ricardo Eihara rhiroyuki

🏠
Working from home
  • Brazil
View GitHub Profile
@rhiroyuki
rhiroyuki / dont_use_merge!.md
Last active July 24, 2019 20:07
dont use merge!

WIP

One of the problems I've faced recently was a ruby class that heavily used merge! through all their methods. If you don't know what .merge do, let me explain it first:

If you have a ruby hash and want to add a new key with a value you have two ways to do it:

product = {
  sku: 'SKU1234567'
}
@rhiroyuki
rhiroyuki / readme.md
Created May 28, 2019 15:01
Usando scp

$ scp -pvC ree@123.123.12.123:/awesomecsvfile.csv .

@rhiroyuki
rhiroyuki / instructions.md
Last active May 27, 2019 14:21
Making VIM clipboard work throught SSH

Access using the -Y option of SSH

$ ssh -Y hey@myip

Check if the VIM installed on the SSH machine is able to use the system clipboard

inside VIM, type :echo has('clipboard'), if it returns 0 then it means it needs to install another distribution that comes with cliboard.

On Ubuntu you can install vim-gtk or vim-gtk3 to install VIM with clipboard, but first you need to remove the current VIM:

$ sudo apt remote vim

:if (has_key(g:plugs, 'nerdtree')) | echo "REE" | endif
WebUI:
https://localhost:15672
@rhiroyuki
rhiroyuki / deploy.sh
Last active April 15, 2019 16:41
Heroku commands
HEROKU_ENVIRONMENT=staging
heroku maintenance:on --remote "$HEROKU_ENVIRONMENT"
heroku ps:scale --remote "$HEROKU_ENVIRONMENT" > dynoscales
heroku ps:scale $(heroku ps:scale --remote "$HEROKU_ENVIRONMENT" | sed -E 's/=([0-9]+):/=0:/g') --remote "$HEROKU_ENVIRONMENT"
git push "$HEROKU_ENVIRONMENT" HEAD:master
# You should check first if you need to run any other scrips before atempting to deploy to production

REDIS

if value is of type string -> GET <key>
if value is of type hash -> HGETALL <key>
if value is of type lists -> lrange <key> <start> <end>
if value is of type sets -> smembers <key>
if value is of type sorted sets -> ZRANGEBYSCORE <key> <min> <max>

command to check the type of value a key mapping to:

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

#! /usr/bin/env bash
# I HATE INTERMITTENT TESTS
RED='\033[0;31m'
NC='\033[0m' # No Color
GREEN='\033[0;32m'
seed=2499
@rhiroyuki
rhiroyuki / readme.md
Last active March 17, 2019 19:02
Lexmark x1180 Scanner Arch/Manjaro