Now located at: https://github.com/epitron/webcam-rng
This file contains hidden or 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 'binding_of_caller' | |
class Object | |
def method_missing(name, *args) | |
if name =~ /^_(\d+)$/ | |
binding.of_caller(2).eval("self").output_array[$1.to_i] | |
else | |
super | |
end | |
end |
This file contains hidden or 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
[1] pry(main)> module Kernel; alias old_p p; def p(*args); if args.any?; old_p(*args.dup); else; old_p(self); end; nil; end; end | |
=> nil | |
[2] pry(main)> p [1,2,3] | |
[1, 2, 3] | |
=> nil | |
[3] pry(main)> [1,2,3].each(&:p) | |
1 | |
2 | |
3 | |
=> [1, 2, 3] |
This file contains hidden or 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
################################################################### | |
## History | |
PRY_CONFIG_DIR = File.expand_path("~/.pry") | |
Pry.history.loader = proc do |&block| | |
Dir["#{PRY_CONFIG_DIR}/history-*.log"].sort_by { |f| File.mtime f }.last(2).each do |fn| | |
File.foreach(fn) { |line| block.call(line) } | |
end | |
end |
This file contains hidden or 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' | |
http = Mechanize.new | |
page = http.get("http://www.focloir.ie/") | |
wotd_link = page.at(".wotdEntry a")["href"] | |
page = http.get(wotd_link) | |
puts page.at("#entryContent").text |
This file contains hidden or 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 ruby | |
require 'mechanize' | |
USERNAME = "" | |
PASSWORD = "" | |
# TODO: Save cookies with "http.cookie_jar.{load,save} filename" | |
# TODO: Store password in ~/.config or some kind of wallet |
This file contains hidden or 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' | |
require 'logger' | |
require_relative 'random_agent' | |
require_relative 'path' | |
# Mechanize::Page subclasses Mechanize::File, Mechanize::Download is its own thing | |
# module MimeInfo | |
# def size | |
# header["content-length"].to_i |
This file contains hidden or 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 'nokogiri' | |
require 'pp' | |
doc0 = %{ | |
<p>Hello <b>DOM!</b></p> | |
} | |
doc1 = %{ | |
<div> | |
<p>Hello <b>DOM!</b></p> |
This file contains hidden or 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
[01:32 AM] epi@rebar :: ~/src/openssl-1.0.1g $ cloc . | |
2354 text files. | |
2135 unique files. | |
762 files ignored. | |
http://cloc.sourceforge.net v 1.60 T=11.68 s (127.0 files/s, 45241.9 lines/s) | |
------------------------------------------------------------------------------- | |
Language files blank comment code | |
------------------------------------------------------------------------------- | |
C 915 32949 68512 234936 |
This file contains hidden or 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
# Rename this distribution example file to motion.conf | |
# | |
# This config file was generated by motion 3.2.12 | |
############################################################ | |
# Daemon | |
############################################################ | |
# Start in daemon (background) mode and release terminal (default: off) |