<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://artha.org/blog/styles/feed.css"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
>
<channel>
<title>sham_blog</title>
<link>http://artha.org/blog/archives/var/index.html</link>
<description>... never said that!</description>
<dc:language>en-us</dc:language>
<dc:creator>shammash</dc:creator>
<dc:date>2010-04-22T00:35:04+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />
<item>
<link>http://artha.org/blog/archives/2010/03/06/index.html#e2010-03-06T11_40_10.txt</link>
<title>tesi specialistica</title>
<dc:date>2010-03-06T11:40:10+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var, tech</dc:subject>
<description><![CDATA[
Finalmente, dopo mesi di gestazione[1], sono arrivato a consegnare la tesi di
laurea specialistica.<br>
<br>
<a target=_blank href='/unibo/tesi_specialistica.pdf'>Design e implementazione
del nuovo framework Virtual Distributed Ethernet: analisi delle prestazioni e
validazione sulla precedente architettura.</a><br>
<br>
Buona lettura!<br>
<br>
[1] o,> e (o(<br>
<br>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2008/10/18/index.html#e2008-10-18T18_46_36.txt</link>
<title>delicious backup</title>
<dc:date>2008-10-18T18:46:36+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var</dc:subject>
<description><![CDATA[
A slightly improved version of
<a target=_blank href='http://snippets.dzone.com/posts/show/290'>this ruby script</a>
you can use to backup your delicious bookmarks to an sqlite3 database.<br><br>

<pre>
#!/usr/bin/env ruby
require 'rexml/document'
require 'net/http'
require 'net/https'
require 'sqlite3'
require 'json'

dbfile_base = 'delicious_bkp_'
rcfile_base = '.delicious_bkp.rc'

agent = 'del.icio.us backup v0.2.1'

schema = &lt;&lt;EOF
create table bookmarks (
    hash char(32) primary key,
    url varchar(1024),
    title varchar(1024),
    note varchar(2048),
    time timestamp
);
create table tags (hash char(32), tag varchar(1024));
create index ix_tags_hash on tags (hash);
create index ix_tags_tag on tags (tag);
EOF
insert_url = 'insert into bookmarks (hash, url, title, note, time) ' +
             'values (?, ?, ?, ?, ?);'
insert_tag = 'insert into tags (hash, tag) values (?, ?);'


rcfile_path = File.join(ENV['HOME'], rcfile_base)
if (not FileTest.exist?(rcfile_path))
	puts "\nERROR: rc file not found!\n\n"
	puts "Create a file " + rcfile_path + " containing the following line:"
	puts "{ \"user\": \"username\", \"pass\": \"password\", \"dir\": \"/path/to/bkp\", \"max_bkp\": 0}\n\n"
	exit -1
end
rcfile = File.open(rcfile_path)
perms = sprintf("%o", rcfile.stat().mode)[-4..-1]
if (perms != "0600")
	puts "\nERROR: rc file permissions are not safe!\n\n"
	exit -1
end
begin
j = JSON.parse(rcfile.read())
rescue JSON::ParserError
	puts "\nERROR: bad syntax in rc file\n\n"
	exit -1
end
['user', 'pass', 'dir', 'max_bkp'].each { |key|
	if (not j.has_key?(key))
		puts "\nERROR: field " + key + " doesn't exist in rc file!\n\n"
		exit -1
	end
}
if (not FileTest.directory?(j['dir']))
	puts "\nERROR: Specified directory does not exist!\n\n"
	exit -1
end

dbfile_base = dbfile_base + j['user'] + "_"
dbfile_name = dbfile_base + Time.now.strftime("%Y-%m-%d.db")
dbfile_path = File.join(j['dir'], dbfile_name)
if (FileTest.exist?(dbfile_path))
	puts "Backup " + dbfile_name + " exists, exiting."
	exit 0
end

http = Net::HTTP.new('api.del.icio.us', 443)
http.use_ssl = true
xml = http.start { |http|
    req = Net::HTTP::Get.new('/v1/posts/all', {'User-Agent' => agent})
    req.basic_auth(j['user'], j['pass'])
    http.request(req).body
}

doc = REXML::Document.new(xml)

SQLite3::Database.open(dbfile_path).transaction { |db|
    db.execute_batch(schema)
    db.prepare(insert_url) { |url_stmt|
        db.prepare(insert_tag) { |tag_stmt|
            doc.elements.each('posts/post') { |el|
                url_stmt.execute(el.attributes['hash'],
                    el.attributes['href'], el.attributes['description'],
                    el.attributes['extended'], el.attributes['time'])
                el.attributes['tag'].split(' ').each { |tag|
                    tag_stmt.execute(el.attributes['hash'], tag)
                }
            }
        }
    }
}

if (j['max_bkp'] > 0)
	d = Dir.new(j['dir'])
	b = []
	re = Regexp.new(dbfile_base + "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.db")
	d.each {|entry| if re.match(entry) then b.push(entry) end }
	if b.nitems > j['max_bkp']
        	b.sort()[0, (b.nitems - j['max_bkp'])].each {|olddb|
	                File.unlink(File.join(j['dir'], olddb))
        	}
	end
end


</pre>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2008/10/18/index.html#e2008-10-18T14_49_47.txt</link>
<title></title>
<dc:date>2008-10-18T14:49:47+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var</dc:subject>
<description><![CDATA[]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2008/06/27/index.html#e2008-06-27T10_53_41.txt</link>
<title>tempo</title>
<dc:date>2008-06-27T10:53:41+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var, fun</dc:subject>
<description><![CDATA[
Ricevo in terra irlandese e pubblico un segno evidente del tempo che passa:<br>
<br>
<img border=0 alt='occhio beppe'
src='http://artha.org/blog/entrimg/occhio_beppe.jpg'><br>
<br>
<i>Nota: il valore di verit&agrave; non cambia sia interpretando "tempo" come
clima (si suda) che come anni (si portano gli occhiali).</i>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2008/04/01/index.html#e2008-04-01T01_29_21.txt</link>
<title>A F this K</title>
<dc:date>2008-04-01T01:29:21+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var, tech</dc:subject>
<description><![CDATA[
see you :)<br>
<br><br>
<img alt='google.ie' src='http://artha.org/blog/entrimg/ggie.gif'>
<br>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2007/09/12/index.html#e2007-09-12T02_52_04.txt</link>
<title>wa</title>
<dc:date>2007-09-12T02:52:04+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var</dc:subject>
<description><![CDATA[I'd like to go there again..<br>
<br>
<img alt='kalberri' src='http://artha.org/blog/entrimg/aus_kalberri.jpg' border=0>
<br><br>
<img alt='shell beach' src='http://artha.org/blog/entrimg/aus_shell-beach.jpg' border=0>
<br><br>
<img alt='road' src='http://artha.org/blog/entrimg/aus_road.jpg' border=0>
<br><br>
<img alt='beach' src='http://artha.org/blog/entrimg/aus_beach.jpg' border=0>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2007/08/28/index.html#e2007-08-28T00_24_29.txt</link>
<title>spot</title>
<dc:date>2007-08-28T00:24:29+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var, fun</dc:subject>
<description><![CDATA[
Oggi ho sentito per caso una pubblicita` in cui ad un certo punto si diceva
piu` o meno cosi`:<br>
<br>
<i>"... il veicolo con il piu` basso valore di emissione di CO2 per passeggero..."</i><br>
<br>
Vale a dire?<br>
<br>
<img src='http://artha.org/blog/entrimg/co2.jpg' alt='co2 fun'><br>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2007/07/18/index.html#e2007-07-18T00_19_48.txt</link>
<title>couch surfing</title>
<dc:date>2007-07-18T00:19:48+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var, tech</dc:subject>
<description><![CDATA[
Probabilmente mi faccio influenzare sia dalla mia passione per i viaggi<br>
che da alcune possibilita` che solo la rete al momento puo` offrire,<br>
ma questo sito mi sembra veramente un'ottima idea:<br>
<br>
<a target=_blank href='http://www.couchsurfing.com/'>www.couchsurfing.com</a><br>
<br>
<i>
CouchSurfing is a worldwide network<br>
for making connections between travelers<br>
and the local communities they visit.<br>
</i>
<br>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2007/07/12/index.html#e2007-07-12T00_45_12.txt</link>
<title>first pic</title>
<dc:date>2007-07-12T00:45:12+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var</dc:subject>
<description><![CDATA[La prima foto assieme dopo 9 anni..<br>
<br>
<img alt='luca e giuly' src='/blog/entrimg/luca_giuly.jpg' border=0><br>
<br>]]></description>
</item>
<item>
<link>http://artha.org/blog/archives/2007/06/16/index.html#e2007-06-16T15_28_09.txt</link>
<title>life pt N</title>
<dc:date>2007-06-16T15:28:09+01:00</dc:date>
<dc:creator>shammash</dc:creator>
<dc:subject>var</dc:subject>
<description><![CDATA[Senso del vomito.<br>
We'll see...<br>
<br>]]></description>
</item>
</channel>
</rss>
