Skip to content

Instantly share code, notes, and snippets.

@epitron
epitron / unfiglet-dorei-slow.rb
Last active August 29, 2015 14:05
Figlet-based CAPTCHA breaker (for IRC bots) -- accelerated!
require 'epitools'
figlet_left = File.readlines('./figlet.input')
def get_first_char(i, arr)
arr.map { |x| x[0..i] }
end
def remove_first_char(i, arr)
arr.map { |x| x.slice(i..-1) }
@epitron
epitron / hanoi.rb
Created August 15, 2014 22:01
Crazy 3-line tower of Hanoi solver.
puts "How many disks? "
n = STDIN.gets.to_i
x = 1
while (x < (1 << n))
puts "move from pole #{(x&x-1)%3} to pole #{((x|x-1)+1)%3}"
x += 1
end
@epitron
epitron / tz
Last active August 29, 2015 14:03
#!/bin/bash
#
# by Sairon Istyar, 2012
# distributed under the GPLv3 license
# http://www.opensource.org/licenses/gpl-3.0.html
#
# Source:
# https://github.com/saironiq/shellscripts/blob/master/torrentz_eu/torrentz_eu.sh
#
### CONFIGURATION ###
@epitron
epitron / gist:887914c6877f4069eb63
Created June 5, 2014 05:48
Things that depend on GnuTLS...
$ apt-cache rdepends libgnutls26 | grep -v lib
Reverse Depends:
aiccu
vino
qemu-kvm
exim4-daemon-light
exim4-daemon-heavy
cups
xen-utils-4.1
wine1.4-amd64
@epitron
epitron / .motion.conf
Created May 29, 2014 21:20
Config file for 'motion', a program to record videos whenever there's motion (I used it for watching my birdfeeder with a webcam.)
# 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)
@epitron
epitron / webcam-rng.md
Last active August 29, 2015 14:00
A webcam CCD noise random number generator
@epitron
epitron / gist:10345271
Last active August 29, 2015 13:58
OpenSSL codebase statistics.
[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
require 'nokogiri'
require 'pp'
doc0 = %{
<p>Hello <b>DOM!</b></p>
}
doc1 = %{
<div>
<p>Hello <b>DOM!</b></p>
@epitron
epitron / http_client.rb
Created April 6, 2014 20:44
A wrapper around Mechanize which implements a caching HTTP client that doesn't blow up if it hits an error pages (like 404).
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
@epitron
epitron / instapaper-backup.rb
Last active October 17, 2017 02:37
An Instapaper scraper.
#!/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