Skip to content

Instantly share code, notes, and snippets.

View m3nd3s's full-sized avatar

Almir Mendes m3nd3s

View GitHub Profile
@m3nd3s
m3nd3s / command.sh
Last active August 29, 2015 14:10
Remote command
#!/bin/bash
HOSTS=$(cat <<EOF
dev.adena.com.br
dev.acimaq.adena.com.br
EOF)
CMD="ls -lah /proc/\$(pidof java)/task | wc -l"
for H in $HOSTS
@m3nd3s
m3nd3s / timezone.rb
Created March 2, 2015 18:01
Conversor de timezone
file = File.new("/Users/m3nd3s/Desktop/schedule.txt", 'r')
begin
report = File.open("/Users/m3nd3s/Desktop/report.txt", 'w')
while(line = file.gets)
cols = line.split(" - ")
utc_time = DateTime.parse(cols[0])
br_time = utc_time.in_time_zone('Brasilia')
@m3nd3s
m3nd3s / find_and_resize.sh
Created March 24, 2015 13:30
Find and resize imagens on path
#!/bin/bash
set -e
for F in $(find . -size +900k)
do
FNAME=`basename $F`
mv "$F" "$F-orig"
echo -n "Converting ${FNAME}: "
convert -strip -quality 80 -resize "1024x768>" "$F-orig" "$F"
echo "done"
@m3nd3s
m3nd3s / find_and_resize.sh
Created May 19, 2015 16:54
Find and Resize Images
#!/bin/bash
set -e
for F in $(find . -size +900k)
do
FNAME=`basename $F`
mv "$F" "$F-orig"
echo -n "Converting ${FNAME}: "
convert -strip -quality 80 -resize "1024x768>" "$F-orig" "$F"
echo "done"
#config/secrets.yml
production:
secret_key_base: "173df1a20fb5d746d33695c5e22762a9fad1211d7321ad1cfa7c0ed53d540337"
@m3nd3s
m3nd3s / rm_to_from_bahia.sh
Created March 11, 2011 00:39
rm to "baianos"
#/bin/bash
#
# now, you must be edit you ~/.bashrc or ~/.bash_profile and add the command:
# alias rm="/path/to/rm_to_from_bahia.sh"
#
# Now you're safe!
echo "ARE YOU SURE YOU WANT TO DELETE ALL THIS SHIT?"
read RESP
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@m3nd3s
m3nd3s / palavra_prima.rb
Created April 12, 2011 17:00
Classe para identificar se a somatório de letras de palavras de uma frase são primas
#http://dojopuzzles.com/problemas/exibe/palavras-primas/
class PalavraPrima
attr_accessor :phrase
def initialize
@@letters =[]
"a".upto("z") { |l| @@letters << l }
"A".upto("Z") { |l| @@letters << l }
end
@m3nd3s
m3nd3s / autor.rb
Created September 15, 2011 12:45
Nomes de Autores de Obras Bibliográficas - Dojo Ruby [http://dojopuzzles.com/problemas/exibe/nomes-de-autores-de-obras-bibliograficas/]
# coding: utf-8
class Autor
attr_accessor :nomes
def initialize(nomes=[])
@nomes = nomes
@nomes_especiais = ["Neto", "Filho", "Sobrinho", "Neta", "Filha", "Sobrinha", "Junior"]
@preposicoes = ["da", "de", "do", "das", "dos"]
end
@m3nd3s
m3nd3s / deploy.rb
Created September 30, 2011 02:25
Palestra de Capistrano no @rockandrails
# Integração com o Bundler
require "bundler/capistrano"
# Integração com RVM
# mais informações: http://beginrescueend.com/integration/capistrano/
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
# Nome da aplicação