This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'net/http' | |
botid = "f5d922d97e345aa1" | |
botcust = "a47d79b2be70536d" | |
url = "http://www.pandorabots.com/pandora/talk" | |
response = Net::HTTP.post_form(URI.parse(url), {'input' => ARGV.join(' '), 'botid' => botid, 'botcust2' => botcust, 'skin' => 'custom_input'}) | |
puts response.body.split("ALICE:").last.split("\n").first.gsub(/<\/?[^>]*>/, "").strip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module Acts | |
module AsFlagable | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def acts_as_flagable(options) | |
unless flagable? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts $1+$2 if "12345555567890" =~ /(\d)(\1{4})/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run rake db:size to get a print of your database size in bytes. | |
# Run rake db:tables:size to get the sizes for individual tables | |
# Works for MySQL and PostgreSQL. Not tested elsewhere. | |
namespace :db do | |
desc 'Print data size for entire database' | |
task :size => :environment do | |
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database] | |
adapter = ActiveRecord::Base.connection.adapter_name.downcase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Varz | |
module GetSet | |
def initialize(init = {}) | |
@variables = init | |
end | |
def get(key) | |
@variables[key] || "Bang!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queryString = { | |
createById: function() { | |
var args = []; | |
for (var i = 0; i < arguments.length; i++) { | |
var el = document.getElementById(arguments[i]); | |
args[i] = el.id + "=" + el.value; | |
} | |
return args.join("&"); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
curl http://gist.github.com/raw/323731/install_homebrew > install_homebrew.rb | |
ruby install_homebrew.rb | |
rm install_homebrew.rb | |
echo "PATH=/usr/local/bin:/Developer/usr/bin:\$PATH; export PATH" >> ~/.profile | |
source ~/.profile | |
echo "Your path is now $PATH" | |
brew install git | |
brew update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
TITLE=$@ | |
[ -z "$TITLE" ] && TITLE="page title" | |
printf "<!DOCTYPE html>\n<html lang=\"pt-br\">\n <head>\n <meta charset=\"utf-8\">\n <title>${TITLE}</title>\n </head>\n <body>\n </body>\n</html>" > index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ROOT_UID=0 # somente para usuarios com privilegio de root | |
E_NOTROOT=87 # erro de usuario nao root | |
SCRIPT_NAME=$(basename $0) # nome do arquivo | |
if [ "$UID" -ne "$ROOT_UID" ] | |
then | |
echo -e "\e[31m\e[40m[ ✗ ] Você deve executar o script '$SCRIPT_NAME' como root." | |
exit $E_NOTROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find fontes -name "*.so" -exec rm -v "{}" \; | |
find fontes -name "*.pyc" -exec rm -v "{}" \; |