Skip to content

Instantly share code, notes, and snippets.

View amejiarosario's full-sized avatar
🎯
Think big, start small, learn fast!

Adrian Mejia amejiarosario

🎯
Think big, start small, learn fast!
View GitHub Profile
#
# Wi-Fi SSID Sniffer in 9 Lines of Ruby using Raw Sockets
#
# No Gem, no lib, just plain Ruby.
# You have to run it with root/sudo.
# My Ruby version is 1.9.3 and I run Linux.
require 'socket'
sock = Socket.new(Socket::PF_PACKET, Socket::SOCK_RAW, 0x03_00)
// single arrow at the end
Raphael.fn.arrow = function(x1, y1, x2, y2, size) {
var angle = Raphael.angle(x1, y1, x2, y2);
var a45 = Raphael.rad(angle-45);
var a45m = Raphael.rad(angle+45);
var x2a = x2 + Math.cos(a45) * size;
var y2a = y2 + Math.sin(a45) * size;
var x2b = x2 + Math.cos(a45m) * size;
var y2b = y2 + Math.sin(a45m) * size;
return this.path(
@amejiarosario
amejiarosario / unix_tricks
Created March 12, 2013 16:18
unix tricks
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
# ./sublime_text
# libgio version is less than 2.26, single instance support disabled
# Segmentation fault (core dumped)
## FIX ##
# You must have gtk-doc installed to compile GLib.
sudo apt-get install gtk-doc-tools
git clone git://git.gnome.org/gtk-doc
@amejiarosario
amejiarosario / redis_es_ls.md
Last active December 14, 2015 02:48 — forked from garlandkr/redis_es_ls.md
new elasticsearch version (elasticsearch-0.20.5)

This will be a copy/paste doc for installing redis, elasticsearch and logstash on ubuntu 12.04

Pre-Requisites

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tcl8.5 tcl8.5-dev build-essential rubygems git \
htop python-dev openjdk-7-jre-headless libcurl4-openssl-dev \
bison ctags flex gperf libevent-dev libpcre3-dev libssl-dev libreadline6-dev \
libtokyocabinet-dev libncursesw5-dev libxml2-dev libxslt1-dev libsqlite3-dev \
@amejiarosario
amejiarosario / elastic_search_tire.rb
Created November 15, 2012 16:41
elastic search cheatsheet
# ~/elasticsearch-0.19.11/bin/elasticsearch -f
#
# Include to and active record model
#
class Log < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
end
@amejiarosario
amejiarosario / capybara cheat sheet
Created July 18, 2012 15:10 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@amejiarosario
amejiarosario / dotfiles_installer.sh
Last active October 6, 2015 10:07
Dotfile installer - Let's automate the boring process for awesome results
# curl -k https://gist.github.com/raw/2976697/a2e9f2ff292a1fe5ceb7ddb05900f73a249abcdb/dotfiles_installer.sh | sudo sh
# create directory
cd ~/
mkdir gists
cd gists
# download git stuff
git clone git://gist.github.com/2931603.git gitconfig
ln -s ~/gists/gitconfig/.gitconfig ~/.gitconfig
@amejiarosario
amejiarosario / rbenv.sh
Created June 21, 2012 04:17
rbenv setup
# Ruby Enviroment (rbenv)[https://github.com/sstephenson/rbenv] (installer) [https://github.com/fesplugas/rbenv-installer]
curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
## Install Ruby
rbenv install 1.9.3-p194
rbenv install 1.9.2-p320
rbenv global 1.9.2-p320
@amejiarosario
amejiarosario / rails_setup.sh
Created June 21, 2012 03:08
Ubuntu and Rails
# Getting Up To Date
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
#reboot your system $ sudo reboot
# Some required programs
sudo apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev ctags vim libreadline-dev libyaml-dev libcurl4-openssl-dev subversion