tiistai 27. marraskuuta 2012

A note on null pointers

Just another reason why I love Linux and FOSS


I am traveling this week at a conference and I wanted to watch the shows my TiVo recorded while at the hotel. All I had to do was:



  • ssh -X homeIP

  • run kmttg to download and convert the video on my home PC

  • scp the video to my laptop at the hotel


It always amazes me how the entire FOSS stack has come together to make almost anything possible and everything I did today are things I have done for the last 10 years!


If I ran Windows I am sure I could have connected to my home PC somehow (RDP maybe?) and used a similar Windows tool to convert it and then used something like Dropbox to copy the file off but with Linux this ability is baked in and usable by default. I didn't have to do anything except setup SSH for remote access to make this possible.



submitted by Darrena to linux

[link] [197 comments]

Replacing WHS with Raspberry Pi, in-kernel RAID, and USB JBOD.


I just replaced my HP WHS with a Raspberry Pi running Raspbian, in-kernel RAID, and a USB jbod. Thought I'd share the process of getting it working, including setting up SMB and email alerts.


The catalyst for me was my Windows Home Server boot drive failing for the second time, making four drive failures in three years in the WHS. I've come to two conclusions:



  • The HP WHS hardware is hard on drives or I'm just unlucky with drives. Either way, I don't want to use discontinued hardware/software.

  • I don't want to boot from a drive that I'm also using as a data store.


Enter the raspberry pi and an external usb jbod. Equipment:



Pros:



  • Cheap, low power, low heat.

  • Keeps data store separate from boot operating system.

  • On a wireless network it's as fast as any other server since even the modest IO speeds of the Pi and USB 2.0 bus exceed wireless network throughput.


Cons:



  • All IO to/from the RAID, including drive rebuild operations, is limited by the USB 2.0 bus speed and the Pi processor. This means that for rebuild operations or for initially loading it with data, you should consider plugging it into a Linux machine with USB 3.0.


Below are quick instructions for getting things set up. When in doubt read the man pages: mdadm, mdadm.conf, ssmtp, ssmtp.conf, smbpasswd, samba or the links at the bottom.


Download software



apt-get install mdadm ssmtp samba samba-common-bin

Replace these variables below with their values as you follow the instructions.



$EMAIL = your gmail email address $LOCALUSER = your non-root username on the raspberry pi $NUMDRIVES = the number of devices contributing to the raid (should be 3 or 4 for RAID 5) $PASSWORD = your gmail password

Set up ssmtp to use your gmail account


Contents of /etc/ssmtp/ssmtp.conf:



root=$EMAIL mailhub=smtp.gmail.com:587 rewriteDomain= hostname=$EMAIL UseSTARTTLS=YES AuthUser=$EMAIL AuthPass=$PASSWORD FromLineOverride=YES

Contents of /etc/ssmtp/revaliases



root:$EMAIL:smtp.gmail.com:587 $LOCALUSER:$EMAIL:smtp.gmail.com:587

Set up RAID 5


Record which devices under /dev belong to the jbod. Skip this if you already know what they are.



cat /proc/partitions > /tmp/partitions

plug jbod in



diff /tmp/partitions /proc/partitions

You can create partitions with raid auto detect set here or just use the devices as they are. I chose the latter.


Create RAID



/sbin/mdadm --create --verbose /dev/md0 --level=5 --raid-devices=$NUMDRIVES /dev/sda /dev/sdb /dev/sdc (replace devices with the ones found earlier)

Format raid



mkfs.ext4 /dev/md0

Verify that it mounts



mkdir /mnt/raid mount /dev/md0 /mnt/raid df -h /mnt/raid

modify this line in /etc/init.d/mdadm to have the RAID monitor send a test email each time it starts. Think of this as a systems test.



--monitor --pid-file $PIDFILE --daemonise --scan --test ${DAEMON_OPTIONS:-}

Get array UUID



mdadm --detail /dev/md0 | grep UUID

Add uuid/md mapping to /etc/mdadm/mdadm.conf



ARRAY /dev/md0 uuid=xxxxx:xxxxx:xxxxxx:xxxxx

Modify MAILADDR LINE in /etc/mdadm/mdadm.conf



MAILADDR $EMAIL

Have /etc/fstab mount the raid on boot



/dev/md0 /mnt/raid ext4 defaults,noatime 0 0

Set up SMB


Add to /etc/samba/smb.conf:



[raid] comment = External RAID read only = no locking = no guest ok = no path = /mnt/raid valid users = $LOCALUSER

Create smb password for user.



smbpasswd -a $LOCALUSER

Reboot the machine or restart mdadm and samba. When it comes back up you should get a test email and have a working fileserver.


Sources:




submitted by john_ringwals to linux

[link] [41 comments]

"How does compression work?"

A quiz that teaches you how to avoid the most common SQL performance issues

Camera Pi – DSLR Camera with Embedded Computer

Street Shootings: Covert Photography and Public Privacy—this Vanderbilt Law Review paper states that it should be possible for public "victims" to successfully sue offensive Street Photographers for "battery."


Street Shootings: Covert Photography and Public Privacy ... {TIL-X-post}


tl;dr: Just read Chaper IV—STREET SHOOTINGS AS BATTERY—page 24 (1154) on through to the conclusion.


According to a Vanderbilt University Law School 2010 Candidate for Doctor of Jurisprudence, most "Invasion of Privacy" lawsuits have been lost because the First Amendment trumps privacy laws when a Street Photographer takes an invasive photo in public; so, she is proposing "an expansion of the tort of battery to include offensive forms of street shootings." This takes on voyeurs, like upskirt photogs, first—but seems to imply broader applications.



Professor Clay Calvert observed, “Continuous review is necessary so that evolutions in technology do not . . . outstrip developments in the law of voyeurism.”



EdiT: Fixed tl:dr



submitted by D0J0 to photography

[link] [2 comments]

Factor 0.95 now available (over 2,500 commits!)

Scanning Negatives on a Budget


I recently bought an el cheapo negative scanner and scanned images that I chose not to print in the past. I do not regret my purchase ('tis better than a contact sheet) but the image clarity, resolution, and overall quality is horrendous (which isn't surprising, but yanno...)


See here


Anyone know where I could get a decent quality negative scanner for relatively cheap? I would love to print the traditional way, but I currently do not have access to a darkroom. Thanks!



submitted by earsbg to photography

[link] [22 comments]

n64js - An N64 Emulator in Javascript

So I was playing around with kahn academy's new IDE/tutorial program. All glory to the hypnotoad!

Introducing Khan Academy: Computer Science, a project led by John Resig that targets people with no programming knowledge

Java SE 7 Update 6 Released!

AngularJs an awesome JavaScript Library Super-powered by Google

Aurinko - A very compact yet powerful networked document database engine in Clojure

Rootbeer compiler lets you easily run most Java code on your GPU

How to auto generate UML diagrams for Java in Eclipse