10 books every hacker should read
Posted by jcubic in Uncategorized on November 15, 2010
Steven Levy – Hackers: Heroes of Computer Revolution

Hackers early history. The story is split into three parts.
- Early days mostly at Tech Model Railroad Club and AI. Lab at MIT
- Hardware Hackers (Homebrew Computer Club and Woz)
- Game Hackers, history of early games mostly created in assembler and basic for apple computer
Sam Williams – Free as in Freedom

Book about Richard M. Stallman, the origin on Free Software Foundation and GNU/Linux. You can read this book online.
Paul Graham – Hackers and Painters

Compilations of Graham essays. Graham is creator of Viaweb, which become Yahho Store and designer of arc lisp dialect. If you want more you can find it on Graham web site
William Gibson – Neuromancer

Classic cyberpunk book. Gibson is a father of cyberpunk he coined the term “cyberspace”.
Lawrence Lessig – Free Culture

Book about Open Society, Free Licensing and Open Source. The book was relased on Creative Commons Attribution/Non-commercial license (by-nc 1.0). You can download the book from offical web site.
Harold Abelson, Gerald Jay Sussman – Structure and Interpretation of Computer Programs

Classic book about programming and solving problems, all examples are in scheme programming language. Sussman design Scheme with Guy L. Steele. You can watch video lectures by authors of this book. You can read it online.
Eric Raymond – The Art of UNIX Programming

Book about the history and culture of Unix programming, and a guide to create open source program in *nix environment. You can read it online.
Open Sources: Voices from the Open Source Revolution

Group of Essays about Open Source. The essays contained were written by Chris DiBona, Sam Ockman, Mark Stone, Brian Behlendorf, Scott Bradner, Jim Hamerly, Marshall Kirk McKusick, Tim O’Reilly, Tom Paquin, Bruce Perens, Eric Raymond, Richard Stallman, Michael Tiemann, Linus Torvalds, Paul Vixie, Larry Wall, and Bob Young. You can read this book online.
Open Sources 2.0 : The Continuing Evolution

Continuation of previous book. The authors of essays are Mitchell Baker, Chris DiBona, Jeremy Allison, Ben Laurie, Michael Olson, Ian Murdock, Matthew N. Asay, Stephen R. Walli, Russ Nelson, Wendy Seltzer, Jusus M. Gonzalez-Barahona, Gregorio Robles, Alotita Sharma, Robert Adkins, Boon-Lock Yeo, Louisa Liu, Sunil Saxena, Bruno Souza, Doc Searls, Tim O’Reilly,Pamela Jones, Andrew Hessel, Eugene Kim, Larry Sanger, Sonali K. Shah, Steven Weber, Jeff Bates, Mark Stone. read this book online
Eric Raymond – New Hacker’s Dictionary

Dead-tree version of Jargon File
My result in Photoshoped quiz
Posted by jcubic in Uncategorized on November 5, 2010
I’ve got 70% in photoshop image recognition.
Created By TheirToys novelties
Create nice looking blockquote with jquery and css
Posted by jcubic in Programming on October 19, 2010
If you want to create nice looking blockquotes on your web page here is simple plugin.

First basic css
.quote {
font-size: 2em;
font-family: Times New Roman, times, serif;
position: relative;
}
.quote p {
margin: auto;
text-align: justify;
}
.quote span {
font-size: 4em;
}
.quote span.open {
position:absolute;
top:-0.35em;
left:0;
}
.quote span.close {
position:absolute;
bottom: -0.8em;
right: 0;
}
code for the plugin
$.fn.quote = function(params) {
$(this).addClass('quote');
var width = params && params.width ? params.width : 400;
$(this).css('width', width);
$(this).html('<p>' + $(this).html() + '</p>');
$(this).find('p').css('width', width - 120);
$(this).append('<span class="close">”</span>');
$(this).prepend('<span class="open">“</span>');
};
create basic html
<blockquote>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sed dolor nisl, in suscipit justo. Donec a enim et est porttitor semper at vitae augue. </blockquote>
And run the plugin
$(document).ready(function() {
$('blockquote').quote({'width': 500});
});
The default width is 400 px
lt
Script for reconnect adsl in d-link router
Posted by jcubic in Programming on October 19, 2010
In work I have wireless network with D-Link router “DSL-2640B”, and I need to reconnect ADSL service to change IP adress, so I write this ruby script, which use telnet standard libary.
#!/usr/bin/ruby
require 'net/telnet'
require 'optparse'
opts = ARGV.getopts('h:p:')
passwd = opts['-p']
host = opts['-h']
server = Net::Telnet::new('Host'=>host,
'Port'=> 23,
'Timeout'=>25,
'Prompt'=> />/)
server.waitfor(/ogin:/)
server.print("admin\n")
server.waitfor(/ssword:/)
server.print("#{passwd}\n")
server.cmd("adsl connection --down")
server.cmd("adsl connection --up")
server.cmd("logout")
You can use it in terminal by typing:
reconnect.rb -p <password> -h <host>
You must wait couple of seconds before your d-link router connect to ADSL.
Script for searching files on rapidshare
Posted by jcubic in Programming on September 15, 2010
This is a script in Ruby, that I wrote, which use filestube.com to search files on rapidshare (It don’t use filestube API — it just fetch and parse html).
#!/usr/bin/ruby
require 'net/http'
require 'uri'
require 'optparse'
require 'rexml/document'
def get(url, data=nil)
url = URI.parse(url)
http = Net::HTTP.new(url.host)
if data
data = data.map{|k,v| "#{k}=#{url_escape(v)}"}.reduce {|a,b|
"#{a}&#{b}"
}
path = url.path + '?' + data
else
path = url.path
end
res = http.get(path, {'Cookie' => 'usr_timeoffset=0'})
res.body
end
def url_escape(o)
if o.class == ''.class
o.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
'%' + $1.unpack('H2' * $1.size).join('%').upcase
}.tr(' ', '+')
else
return o
end
end
def filestube_urls(query, page=nil, sort=nil, size=nil)
url = "http://www.filestube.com/search.html"
data = {
'q' => query,
'select' => 'All',
'hosting' => 1
}
if size
data['size'] = size
end
if sort
data['sort'] = sort
end
regex = /<a href="([^"]*)" class="resultsLink">.*?<\/a>/
if page
data['page'] = page
end
get(url, data).scan(regex).map {|i| i[0]}
end
def extract_urls(page)
if page =~ /<pre id="copy_paste_links"[^>]*>(.*)<\/pre>/m
$1.strip.split("\n").each{|url|
yield url
}
end
end
def rapidshare_urls(query, num=nil, sort=nil, size=nil)
if num
if num / 10 > 1
result = []
(2..num/10+1).each {|page|
filestube_urls(query, page, sort, size).each {|url|
extract_urls(get(url)) {|url|
yield url
}
}
}
else
filestube_urls(query, nil, sort, size)[0..num-1].each {|url|
extract_urls(get(url)) {|url|
yield url
}
}
end
else
filestube_urls(query, nil, sort, size).each {|page|
extract_urls(get(page)) {|url|
yield url
}
}
end
end
def usage()
puts "usage:"
puts "rapidsearch.rb [-n number] [-o order] [-s size] [-h]"
puts
puts "-n number of url packages"
puts "-h this help screen"
puts "-s size:"
puts " 1 - <20MB"
puts " 2 - 20MB - 200MB"
puts " 3 - 200MB - 1GB"
puts " 4 - >1GB"
puts "-o sort by (default relevance):"
puts " pd - popularity"
puts " dd - date"
puts " sd - size"
end
params = ARGV.getopts('n:o:s:h')
if params['h']
usage
exit
elsif params['o'] and !["pd", "dd", "sd"].include?(params['o'])
puts "Bad parameter -o #{params['o']}"
usage
exit
elsif params['s'] and ![1,2,3,4].include?(params['s'].to_i)
puts "Bad size #{params['s']}"
usage
end
query = ARGV.join(' ')
begin
if params['n']
rapidshare_urls(query, params['n'].to_i, params['o'], params['s']) {|url|
puts url
$stdout.flush
}
else
rapidshare_urls(query, nil, params['o'], params['s']) {|url|
puts url
$stdout.flush
}
end
rescue Interrupt, Errno::EINTR
exit(0)
end
You can use this like this:
rapidsearch.rb -n 10 Matrix
this will display urls for 10 packages containgin word “Matrix”.
-o option is for size of packages (1 – 4)
-s option is for sorting it must be one of (dd – by data, pd – by popularity, sd – by size)
You can download this script from here.
You can combine this script with for validating rapidshare links.
rapidsearch.rb -n 5 -s 3 Matrix | rapidtest.rb -f -
Script in Ruby for validating rapidshare links
Posted by jcubic in Programming on September 15, 2010
This is script which I wrote for testing if file exist on rapidshare hosting service, it use Rapidshare API
require 'net/http'
require 'uri'
require 'optparse'
class FalseException < Exception
end
def check(file, quiet=nil)
file.each_line {|url|
begin
url = url.stript
#skip blank lines, comments and invalid urls
if url =~ /^\s*$/ or url =~ /^\s*#/ or
not url =~ /^http:\/\// or
not url =~ /files\/([0-9]*)\/(.*)/
next
else
fileid = $1
filename = $2
query = "?sub=download_v1&fileid=#{fileid}&filename=#{filename}"
apiurl = URI.parse('http://api.rapidshare.com/cgi-bin/rsapi.cgi')
page = Net::HTTP.new(apiurl.host).get(apiurl.path + query).body
if page =~ /File deleted/ or
page =~ /This file is marked as illegal/ or
page =~ /Filename invalid./ or
page =~ /File not found/
if quiet
raise FalseException
end
if RUBY_PLATFORM =~ /(:?mswin|mingw)/i
puts "#{url} [FAIL]"
else
#display red FAIL on n*ix system
system("echo \"#{url} [\x1b[31m\x1b[1m\"FAIL\"\x1b[0m]\"")
end
else
if quiet == nil
if RUBY_PLATFORM =~ /(:?mswin|mingw)/i
puts "#{url} [OK]"
else
#display green OK on *nix system
system("echo \"#{url} [\x1b[32m\x1b[1m\"OK\"\x1b[0m]\"")
end
end
end
end
rescue Timeout::Error, Errno::ETIMEDOUT
puts "Timeout Error, try again"
redo
end
}
end
def usage()
puts "rapidtest.rb [-f (filename | - )] [-h]"
end
opts = ARGV.getopts('f:hq')
if opts['h']
usage
exit(0)
end
filename = opts['f']
if filename
begin
if filename == '-'
check(ARGF)
else
File.open(filename) {|file|
check(file, opts['q'])
}
end
rescue Interrupt, Errno::EINTR
exit(1)
rescue FalseException
exit(1)
end
end
exit(0)
It will display url and [FAIL] or [OK] (on unix like system it display in color), or return true or false when used with -q option.
You can use it with -f option which must be filename with urls or – to read from stdin
If you using linux you can use xclip program to get data from clipboard.
If you have some urls in clipboard you can use:
xclip -o -sel clip | rapidtest.rb -f -
You can download it from here.
you can test if all files are valid with:
xclip -o -sel clip | rapidtest -f- && echo 'all fine' || echo 'some are invalid'
You can put this script in panel and display GUI message dialogs with zenity
function ok() {
zenity --info --title "rapidtest" --text "all links are valid"
}
function error() {
zenity --error --title "rapidtest" --text "some links are invalid"
}
xclip -o -sel clip | rapidtest.rb -q -f- && ok || eror
I just got 666 reputation on stackoverflow.
Posted by jcubic in Programming on September 14, 2010


