Skip to content

Instantly share code, notes, and snippets.

View nerijunior's full-sized avatar

Neri J. Jakubowski Jr. nerijunior

View GitHub Profile
@nerijunior
nerijunior / sidekiq_hacks.md
Created August 10, 2021 19:39 — forked from luciotbc/sidekiq_hacks.md
sidekiq hacks

Sidekiq

Infra

Parando o sidekiq usando o rails (recomendado)

ps -ef | grep sidekiq | grep busy | grep -v grep | awk '{print $2}' > tmp/sidekiq.pid
cat tmp/sidekiq.pid
bundle exec sidekiqctl stop tmp/sidekiq.pid
@nerijunior
nerijunior / taxa-selic.json
Created September 4, 2020 15:54
Taxa SELIC retirada do Banco Central - UPDATE: 04/09/2020
[
{
"data": "05/08/2020",
"mes": null,
"ano": null,
"inicio": "06/08/2020",
"fim": ""
},
{
"data": "17/06/2020",
@nerijunior
nerijunior / brand-new-mac.rb
Last active October 7, 2019 03:26
Brand New Mac Installation Script
#!/usr/bin/ruby
system("gem", "install", "tty-prompt")
system("xcode-select", "--install")
require "tty-prompt"
class Installer
def initialize(prompt)
@prompt = prompt
@nerijunior
nerijunior / wait-for-it.sh
Created February 28, 2019 19:48
Wait for it
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
WAITFORIT_cmdname=${0##*/}
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2

Keybase proof

I hereby claim:

  • I am nerijunior on github.
  • I am nerijunior (https://keybase.io/nerijunior) on keybase.
  • I have a public key whose fingerprint is 331D 57B6 F852 0F79 758E E3C3 E82B 7FEC 506F CADE

To claim this, I am signing this object:

@nerijunior
nerijunior / swap.sh
Created August 23, 2018 18:55
Swap for Server
# Create Swap
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make Swap permanent
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
@nerijunior
nerijunior / ubuntu-server-commands.md
Created July 17, 2018 14:11
Ubuntu Server Commands

Using port PID

lsof -ti tcp:8889

Search process by PID

ps aux | grep PID

@nerijunior
nerijunior / mysqluser.sql
Last active March 23, 2019 18:17
create mysql user and grant
CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
#CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mydatabase . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
@nerijunior
nerijunior / remove-old-logs.sh
Last active July 10, 2018 18:51
Remove old logs
# +10 = ten days
find /var/log/* -mtime +10 -exec rm {} \;