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
lambda { | |
setups = [] | |
events = {} | |
Kernel.send :define_method, :event do |name, &block| | |
events[name] = block | |
end | |
Kernel.send :define_method, :setup do |&block| | |
setups << block |
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
#enable globals terminal colors | |
export CLICOLOR=1 | |
export LSCOLORS=exfxcxdxbxegedabagacad | |
# terminal hist config | |
export HISTFILESIZE=100000 | |
export HISTCONTROL=ignoredups | |
export HISTSIZE=20000 | |
export HISTIGNORE="[ ]*:&:bg:fg:ls -l:ls -al:ls -la:ls1:lsa:lsr:gits:gits?" |
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
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'skalnik/vim-vroom' | |
Bundle 'vim-scripts/L9' | |
Bundle 'vim-scripts/FuzzyFinder' | |
Bundle 'vim-scripts/rubycomplete.vim' | |
Bundle 'ervandew/supertab' |
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
sudo ln -fs `which ruby` /usr/bin/ruby | |
sudo ln -fs `which erb` /usr/bin/erb | |
sudo ln -fs `which gem` /usr/bin/gem | |
sudo ln -fs `which irb` /usr/bin/irb | |
sudo ln -fs `which rake` /usr/bin/rake | |
sudo ln -fs `which rdoc` /usr/bin/rdoc | |
sudo ln -fs `which ri` /usr/bin/ri | |
sudo ln -fs `which testrb` /usr/bin/testrb |
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
# extracted and prettified from the exploit gem metadata (https://gist.github.com/d891e876c53e55bf0920) | |
# context: https://news.ycombinator.com/item?id=5139720 | |
require 'net/http' | |
require 'digest' | |
require 'openssl' | |
require 'base64' | |
aes = proc { |text| | |
aes_256 = OpenSSL::Cipher.new('aes-256-cbc') | |
aes_256.encrypt | |
aes_256.key = Digest::MD5.hexdigest(`uname -r`) |
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
ActiveRecord cheat sheet / EXAMPLES | |
INSTALL | |
======= | |
$ gem install activerecord | |
in GEMFILE: gem ‘activerecord’ | |
REQUIRE | |
======= | |
require ‘active_record’ |
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
require 'mechanize' | |
@all_links = [] | |
m=Mechanize.new | |
p=m.get("http://www.alexa.com/topsites/category/News") | |
while true | |
puts "current page url #{p.uri}" | |
links=p.css('li.site-listing .desc-paragraph a').map { |l| l.text } | |
if(links.size ==0) | |
puts "no links found on current page #{p.uri}" | |
break |
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
require 'mechanize' | |
playlist = [] | |
playlist_details = [] | |
def find_more(song) | |
page=Mechanize.new.get("https://www.discogs.com/search/?q=#{song}") | |
links=page.search('#search_results .card').map{|f| f.search('a').first[:href]} | |
link = find_link(links) | |
if link | |
get_details("http://#{page.uri.host}#{link}") | |
else |