Installing Diaspora on Ubuntu on VirtualBox

Installing Diaspora on Ubuntu on VirtualBox

I wrote up a little howto on the Diaspora git hub:
https://github.com/diaspora/diaspora/wiki/Installing-Diaspora-on-Ubuntu-on-VirtualBox

Converting a Magnet Link into a Torrent

UPDATE – 2012-04-30 – User Faless on GitHub has added a good bit of functionality. Check it out.

For some reason, my version of the rtorrent client on ubuntu does not open magnet files. So, I wanted to see if there was a way to create torrent files from magnet files. I couldn’t find a good example, so I wrote my own.

This will convert a magnet link into a .torrent file:

First, make sure your system has Python and the Python Library:

sudo apt-get install python-libtorrent

Then, you can run the following code by calling this command:

python Magnet2Torrent.py

File Magnet2Torrent.py:

'''
Created on Apr 19, 2012
@author: dan
'''
 
if __name__ == '__main__':
    import libtorrent as lt
    import time
 
    TorrentFilePath = "/home/dan/torrentfiles/" + str(time.time()) + "/"
    TorrentFilePath2 = "/home/dan/torrentfiles/" + str(time.time()) + "/" + str(time.time()) + ".torrent"
    ses = lt.session()
    #ses.listen_on(6881, 6891)
    params = {
        'save_path': TorrentFilePath,
        'duplicate_is_error': True}
    link = "magnet:?xt=urn:btih:599e3fb0433505f27d35efbe398225869a2a89a9&dn=ubuntu-10.04.4-server-i386.iso&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A80"
    handle = lt.add_magnet_uri(ses, link, params)
#    ses.start_dht()
    print 'saving torrent file here : ' + TorrentFilePath2 + " ..."
    while (not handle.has_metadata()):
        time.sleep(.1)
 
    torinfo = handle.get_torrent_info()
 
    fs = lt.file_storage()
    for file in torinfo.files():
        fs.add_file(file)
    torfile = lt.create_torrent(fs)
    torfile.set_comment(torinfo.comment())
    torfile.set_creator(torinfo.creator())
 
    f = open(TorrentFilePath2 + "torrentfile.torrent", "wb")
    f.write(lt.bencode(torfile.generate()))
    f.close()
    print 'saved and closing...'
 
#Uncomment to Download the Torrent:
#    print 'starting torrent download...'
 
#    while (handle.status().state != lt.torrent_status.seeding):
#        s = handle.status()
#        time.sleep(55)
#        print 'downloading...'

This will create a folder inside of ‘/home/dan/torrentfiles/’ with a structure like:

/home/dan/torrentfiles/545465456.12/545465456.12.torrent

I added this to GitHub if you want to Fork it.
https://github.com/danfolkes/Magnet2Torrent

ENJOY!

Ubuntu Samba – Read-Write-FSTAB-Cifs-Mount


This is my current setup for my two Ubuntu 10.10 (Maverick Meerkat) boxes. One shares a read/write folder to the other. This is my setup. I think the key to this is having the same username on both computers having access to the files.

You might have to run this on the the folder:
sudo chmod -R 777 /path/to/files
sudo chown -R usernameonbothcomputers:usernameonbothcomputers /path/to/files

I installed samba by doing: sudo apt-get install samba

/etc/samba/smb.conf : (on the computer serving the files)

[global]
	workgroup = WORKGROUP
	server string = %h server (Samba, Ubuntu)
	dns proxy = no
 
	interfaces = 127.0.0.0/8 eth0
	bind interfaces only = yes
 
	log file = /var/log/samba/log.%m
	max log size = 1000
	syslog = 0
 
	panic action = /usr/share/samba/panic-action %d
	encrypt passwords = true
	passdb backend = tdbsam
	obey pam restrictions = yes
	unix password sync = yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	pam password change = yes
 
	guest account = nobody
	invalid users = root
	usershare allow guests = yes
 
[MyFiles]
	path = /path/to/share
	writable = yes
	read only = no
	valid users = usernameonbothcomputers

sudo /etc/init.d/smbd reload

/etc/fstab : (on the computer accessing the files)

//SAMBASHAREsSERVERNAME/MyFiles /path/to/mount cifs users,,noatime,username=usernameonbothcomputers,password=theuserspassword 0 0

You should be able to run this to mount all things in your fstab:
sudo mount -a