Skip to content

Instantly share code, notes, and snippets.

View carlosipe's full-sized avatar
⛰️
🪂

Carlos I. Peña carlosipe

⛰️
🪂
View GitHub Profile
@carlosipe
carlosipe / wpa.sh
Created May 24, 2013 20:30
wpa_supplicant.sh
sudo bash
echo "password" | wpa_passphrase "My Essid" > /etc/wpa_supplicant.conf
wpa_supplicant -D wext -c /etc/wpa_supplicant.conf -i wlan0
dhclient wlan0
#or
#iwconfig wlan0 192.168.1.123/24 up && ip ro add 0/0 via 192.168.1.1
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@carlosipe
carlosipe / form_tag.rb
Created June 20, 2013 21:59
form_tag padrino
def form_tag(url, options={}, &block)
desired_method = options[:method].to_s
options.delete(:method) unless desired_method =~ /get|post/i
options.reverse_merge!(:method => 'post', :action => url)
options[:enctype] = 'multipart/form-data' if options.delete(:multipart)
options['accept-charset'] ||= 'UTF-8'
inner_form_html = hidden_form_method_field(desired_method)
inner_form_html << csrf_token_field unless desired_method =~ /get/i
inner_form_html << mark_safe(capture_html(&block))
concat_content content_tag(:form, inner_form_html, options)
@carlosipe
carlosipe / log.txt
Created June 23, 2013 23:37 — forked from solnic/log.txt
$ history | awk {'print $2, $3, $4'} | sort | uniq -c | sort -k1 -rn | head -n 30
610 git status
568 git commit -m
491 git add .
252 git push origin
176 bundle
138 rails s
128 ls
120 git commit --amend
114 git reset --hard
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
for i in {1..200}; do wget http://www.example.com/captcha.php -O $i.png;done;
#uninstall all gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@carlosipe
carlosipe / install-opencv-ubuntu.sh
Created July 27, 2013 15:34
Install opencv ubuntu
sudo apt-get install cmake libgtk2.0-dev python-numpy
wget http://ufpr.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.6.1/opencv-2.4.6.1.tar.gz #(or link here: http://sourceforge.net/projects/opencvlibrary/?source=dlp)
cd OpenCv-2-4-0
tar xf opencv*
cd opencv*
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_NEW_PYTHON_SUPPORT=ON -D CMAKE_INSTALL_PREFIX=/usr/local ./
make && sudo make install
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 1 # manual proxy config
profile["network.proxy.http"] = "localhost"
profile["network.proxy.http_port"] = 8080
Capybara::Selenium::Driver.new(app, :profile => profile)
end