Skip to content

Instantly share code, notes, and snippets.

View adilsoncarvalho's full-sized avatar

Adilson Carvalho adilsoncarvalho

View GitHub Profile
@brodock
brodock / logrotate_rails_application
Last active August 29, 2015 14:04
Silver Bullet Nginx Vhost Recipe for Rails application with HTTPS + Webp + Capistrano + Linux FHS
# This file should be placed at /etc/logrotate.d/
/srv/*/shared/log/*.log {
daily
missingok
dateext
rotate 30 # amount of days to keep compressed logs (you should backup it up externally)
compress
delaycompress
notifempty
@vyper
vyper / bash-in-parallel.sh
Created June 20, 2015 08:14
Looping in parallel using bash
function wait_run_in_parallel()
{
local number_to_run_concurrently=$1
if [ `jobs -np | wc -l` -gt $number_to_run_concurrently ]; then
wait `jobs -np | head -1`
fi
}
function get_status() {
local line=$1
import System.Linq.Enumerable
words = ("blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese")
wordGroups = words.GroupBy({ w | w[0] })
for g in wordGroups:
print "Words that start with the letter $(g.Key):"
for word in g: print "\t$word"
@jehiah
jehiah / bitly.rb
Created February 25, 2011 04:46 — forked from richardtifelt/bitly.rb
# Bit.ly API implementation - thanks to Richard Johansso http://gist.github.com/112191
require 'httparty'
class Api::Bitly
include HTTParty
base_uri 'api.bit.ly'
format :json
# Usage: Bitly.shorten("http://example.com")
def self.shorten(url)
@kneipp
kneipp / gem install mysql2
Created May 23, 2011 19:36
Instalação gem mysql2 no OS X 10.6.7
Passos que segui para conseguir instalar a gem mysql2,
pois o comando de forma tradicional gem install mysql2 não estava funcionando.
1) locate mysql_config
Não listava nada, porém tenho mysql rodando aqui com PHP.
2) brew install mysql
3) locate mysql_config
/Applications/MAMP/Library/bin/mysql_config
@sashich
sashich / redmine
Created June 15, 2011 05:17
redmine init.d shell script
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
#Output
<div class="section">
<h3>Sample Title</h3>
<div class="in">
<div class="field">
<label>Date</label><br/>
<input id="name" name="name" type="text">
</div>
</div>
</div>
@klauswuestefeld
klauswuestefeld / gist:2775926
Created May 23, 2012 15:33
Skype Public Chat Room - Setting Up Your Own
We couldn’t find that file to show.
@adilsoncarvalho
adilsoncarvalho / install-ruby
Last active October 12, 2015 01:58
Installing Ruby 1.9.3p286 on Ubuntu (production server)
#!/bin/bash
# must run as root!!!
RUBY_VERSION=1.9
RUBY_PATCH=1.9.3-p429
#RUBY_PATCH=1.9.3-p385
#RUBY_PATCH=1.9.3-p286
#RUBY_PATCH=1.9.3-p194
cd /tmp
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
git checkout v`git --version | awk '{print $3}'`
cp contrib/completion/git-completion.bash ~/.git-completion.bash
cd ~
rm -rf /tmp/git
echo -e "source ~/.git-completion.bash" >> .profile