Skip to content

Instantly share code, notes, and snippets.

/var/www/[app_path]/shared/log/*.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
copytruncate
}
@renatonitta
renatonitta / puma.rb
Created September 8, 2020 18:52
Puma + Sidekiq: systemd units and configs
#!/usr/bin/env puma
environment = ENV.fetch('RAILS_ENV', 'production')
threads 0, 4
workers 1
bind 'tcp://0.0.0.0:9292'
preload_app!
plugin :tmp_restart
@renatonitta
renatonitta / brew-list.sh
Created February 24, 2020 23:18 — forked from eguven/brew-list.sh
List all packages installed using Homebrew and their sizes
brew list -f1 | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
@renatonitta
renatonitta / tutorial.md
Created September 30, 2016 20:26 — forked from hendricius/tutorial.md
Starting Sidekiq via upstart on Ubuntu using rbenv

The Sidekiq service config. Goes into /etc/init/sidekiq.conf

# /etc/init/sidekiq.conf - Sidekiq config

# This example config should work with Ubuntu 12.04+.  It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See workers.conf for how to manage all Sidekiq instances at once.
@renatonitta
renatonitta / bijective.rb
Created November 11, 2011 01:36 — forked from zumbojo/bijective.rb
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
base = alphabet.length
exports.encode = (i) ->
return alphabet[0] if i is 0
s = ""
while i > 0
s += alphabet[i % base]
i = parseInt(i / base, 10)
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
base = alphabet.length
exports.encode = (i) ->
return alphabet[0] if i is 0
s = ""
while i > 0
s += alphabet[i % base]
i = parseInt(i / base, 10)
var current_page = 1;
scroll = {
'check': function() {
if (scroll.near_bottom()) {
current_page++;
$('#ui-tabs-1').html('<div class="page"></div>');
console.log("chegou em baixo");
console.log(current_page);
#to add git and rvm info
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='`rvm-prompt i v g` \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
export PS1='`rvm-prompt i v g` \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '