Archive

Archive for the ‘In General’ Category

f.lux screen temp adjustment

November 8, 2013 2 comments

It’s been a while since I have posted here, but I thought it best to pick it up again 🙂

A few weeks ago I found this website that adjusts your screen temp to accommodate the time of day. Here is a quick description below:

f.lux fixes this: it makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.

It’s even possible that you’re staying up too late because of your computer. You could use f.lux because it makes you sleep better, or you could just use it just because it makes your computer look better.

Check it out @

http://justgetflux.com/

Just to clarify this does work on Ubuntu / Raring, I’ve also installed it to my Windows and random laptops around the home. When working  late night, your eyes don’t feel like they are being burned out of your head from staring at the computer screen.

Try it out!

Advertisements

Filing Bugs for Ubuntu on the Nexus 7

November 15, 2012 Leave a comment

Filing Bugs for Ubuntu on the Nexus 7

In recent news a custom build of Ubuntu has hit the internet for the Nexus 7. That means wiping android and testing out this fresh build natively on your tablet !!

With a growing number of users filing bugs everyday my co worker recently posted an awesome guide for those of you wanting to file bugs and contribute to the community. Check it out!

Categories: In General

Generating a clean MD5 Sum check file in python3

October 18, 2012 Leave a comment

This week I was stuck on a small problem involving me to generate hash sums for validation. Since I’ve been working on a automation project at work focusing on creating 100% hands free testing tools. A part of my test called for some basic procedures but I wanted to verify that the integrity of the data was sane. The original script that I was updating was written in Bash. Pretty much straight forward but yet, still room for improvement!  I decided to revise the script and convert it over to python, doing so would also make a more powerful tool giving the versatility that python has over simple bash scripts. src and dst are 2 parameters that are called elsewhere in the script. Essentially they are strings pointing to a path on your hard disk, for example dst = “/tmp/blah/blah/”


def prepimage(src, dst):
    '''
    Obtain sample files
    '''
    filename = "%s/md5sum.txt" % (dst)
    md5path = "%s/" % (dst)
    print ("Copying data and Generating md5sums")
    if not os.path.exists(dst):
        shutil.copytree(src, dst)

    #Generate md5sums
        list = subprocess.check_output(["ls", dst],universal_newlines=True)
        plist = list.split('\n')[0:2]
        f = open(filename, "wt")
        for item in plist:
           out = subprocess.Popen(['md5sum', item], universal_newlines=True\
                 , stdout=subprocess.PIPE, cwd='%s' % dst).communicate()[0]
           f.write(out)
        f.close()
    return 0

Lines 7 – 9 are simply creating my directory if it doesn’t exist.

We start @ Line 12,

list = subprocess.check_output(["ls", dst],universal_newlines=True)
        plist = list.split('\n')[0:2]

Using subprocess.Popen we kick of an “ls” command. dst is an argument that we set earlier pointing to a random directory. This will now give us output of something like this:

‘How fast.ogg\nJosh Woodward – Swansong.ogg\nmd5sum.txt\n’

the 2nd line will split the string using the delimiter \n to give us:

[‘How fast.ogg’, ‘Josh Woodward – Swansong.ogg’]

Now using this list, we can create a new file as I do in 14 and kick off a for loop to run md5sum against each entry in the list and write the output to our new file. The final output will look just like this:

cat /tmp/optical-test/Ubuntu_Free_Culture_Showcase/md5sum.txt 6e34a2a0eaa61748ba3a33015a84e813 How fast.ogg c9459a907b9345b289ba6c9e6517d4c2 Josh Woodward – Swansong.ogg

On the flip side, you can automate the integrity check by creating a new function and adding:


#Verify md5checksum
checkoutput = subprocess.Popen(['md5sum', '-c', 'md5sum.txt']
, universal_newlines=True, stdout=subprocess.PIPE\
, cwd='/media/CDROM/').communicate()[0]

Which should output:

How fast.ogg: OK

Josh Woodward – Swansong.ogg: OK

 

—————————————————————————————–

Python 3 also makes use of hashlib to generate the hashsum.. If you don’t need a checksum file then heres some alternate code you can use!

import hashlib
...
...
filename = "/tmp/file1.txt"
...
file = open(filename, 'rb')
filedata = file.read()
file.close()
md5 = hashlib.md5()
md5.update(filedata)
md5sum = md5.hexdigest()
print (md5sum)

This would generate just the hashsums:

6e34a2a0eaa61748ba3a33015a84e813
c9459a907b9345b289ba6c9e6517d4c2

How to backup all my Windows pics to the Linux box

March 25, 2012 Leave a comment

So if your like me, then you shoot RAW!  I use Adobe Photoshop CS5 and Adobe Lightroom 3.5 for most of my post imaging which means my photography is mostly saved on a windows box. So there’s really no “play nice” backup solution. Plus I have about 20 some odd GB of photos which makes FTP out of the question.  What would be ideal is if they made rsync for windows….  Wait, they do!  Check it out here using Cygwin.

So assuming your using a file server like Ubuntu I’ll jot down some instructions so you can do this at home as well!

I’m already guessing that you have rsync installed on your linux box, if not that can be easily fixed by:

#sudo apt-get install rsync

  1. Create a file named rsyncd.conf in /etc
    1. #sudo vi /etc/rsyncd.conf
    2. Add the following to rsyncd.conf, replacing all instances of usernamewith your Ubuntu username:
      [usernamebackup]
      
          path = /home/username/backup
          comment = Backup
          uid = username
          gid = username
          read only = false
          auth users = username
          secrets file = /etc/rsyncd.secrets
    3. #sudo chmod 644 /etc/rsyncd.conf
  2. Create a file named rsyncd.secrets in /etc
    1. #sudo vi /etc/rsyncd.secrets
    2. Add the following to rsyncd.secrets, replacing username with your username and passwordwith a password of your choosing:
      username:password
    3. #sudo chmod 600 /etc/rsyncd.secrets
  3. Open rsync port by editing /etc/default/rsync and setting
    RSYNC_ENABLE=true
  4. Restart rsync
    #sudo /etc/init.d/rsync restart

Set up rsync client on Windows

  1. Install Cygwin, making sure  Net > rsync (3.0.8) and Net > openssh are selected
  2. Add C:\cygwin\bin;to the Windows PATH statement
    1. Right-click on My Computer and select Properties
    2. Switch to the Advanced tab and click the Environment Variables button at the bottom
    3. Find the “Path” or “PATH” variable in the System variables list at the bottom and click Edit
    4. Add C:\cygwin\bin; to the beginning of the list
  3. Create secret file to store password in Cygwin
      1. Start Cygwin Bash Shell
      2. Create secret file in the filesystem root and enter only the password in rsyncd.secrets above, with no spaces or line breaks
    #vi /secret
    #chmod 600 /secret
  4. Create bat file to run rsync
    1. Open Notepad and enter the following command, replacing User Name with your Windows User Name directory, username with your Ubuntu username, and ipaddress with the IP address of your Ubuntu server (e.g. 192.168.1.35):
      C:\cygwin\bin\rsync.exe --chmod u+rwx -qrtzv --password-file=/secret --delete "/cygdrive/d/photos" username@ipaddress::usernamebackup

      This will copy "/cygdrive/d/photos"  to the path specified in the rsyncd.conf. .

    2. Save the file as C:\rsync.bat

Now to simply kick off a backup just copy the batch file to your desktop and kick that off every time you finish your edits. You could also create a schedule task to execute the batch script daily @ midnight, I prefer to just run it manually as I don’t keep my linux box up or windows system 24/7

ARM Hardfloat takes it up a notch in the performance category.

March 8, 2012 Leave a comment

http://www.phoronix.com/scan.php?page=article&item=ubuntu_1204_omap4460&num=1

Great article above, it’s looking good for armhf , I’m still waiting for the armhf TI patches for gstreamer/totem (Unless they have already been released)  I don’t see them here on

TI OMAP devel trunk PPA

, im pretty sure those are only available for Oneiric still. You can also get them integrated if you just build using linaro tools , assuming you have the correct hwpack and binary.

With the cpufreq support enabled, the dual-core Cortex-A9 can now run as low as 300MHz or ramp up to its highest 1.2GHz frequency stepping when needed. Without the cpufreq support, the SoC is just stuck running at around 1.0GHz. With this support finally enabled for Ubuntu Linux, there is some immediate performance boosts for the PandaBoard ES.

How to retrieve data after experiencing read errors on a USB stick

March 7, 2012 Leave a comment

So I figured I’d post this handy piece of info. Ever have to copy data from a USB stick and run into read errors.  I just did 😦

So aside from the fact I have some shitty USB keys, I really needed to save the data on this 4GB stick. I was able to retrieve the whole partition using gddrescue.  You can grab it from Ubuntu ppa..

sfeole@sfeolework:~$ apt-cache policy gddrescue
gddrescue:
Installed: 1.14-1
Candidate: 1.14-1
Version table:
*** 1.14-1 0
500 http://us.archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages
100 /var/lib/dpkg/status

Read more about it here:

http://www.gnu.org/software/ddrescue/ddrescue.html

So by carrying out the following I was able to pull the partition off my USB stick, this copies the data block for block.

sfeole@sfeolework:~$ time sudo ddrescue -r3 -f /dev/sdb my4gusb.img
Press Ctrl-C to interrupt
rescued: 4012 MB, errsize: 0 B, current rate: 18481 kB/s
ipos: 4012 MB, errors: 0, average rate: 17958 kB/s
opos: 4012 MB, time from last successful read: 0 s
Finished

real 3m43.060s
user 0m0.308s
sys 0m13.773s

From here I was able to use a fresh new USB stick and DD my image back.

sfeole@sfeolework:~$dd if=my4gusb.img of=/dev/sdb

Where is Windows 8 going?

March 5, 2012 3 comments

So while going through my list of websites that I usually catch up on I was sent this link here regarding windows 8. I love the picture above btw, might to have to add it to my collection!

http://www.extremetech.com/computing/121015-windows-8-may-drive-me-to-linux

Now just by reading the title you would think that this is sort of a bashing the Window 8 OS itself, well quite frankly it is. It’s interesting the direction that microsoft is going. I’m not sure if everyone over there has their screws snugged tight, if you know what i mean.

May favorite pieces of this article:

Based on its current form, Windows 8 represents an unconscionable, and barely comprehensible, rejection of the values Microsoft has spent the last 26 years perfecting in its visual operating system.

And, of course, there are plenty of serious users who don’t want the PC on which they spend huge chunks of their waking life to look like it was designed by Fisher-Price.

I would have to agree with the Matthew Murray on this one, I’m really content with windows 7. In the event I want to play a game or two, i usually fire up my windows 7 box and game away. The world is not all tablets… yet???  hehe…  doubtful..  but again I would like to see how this pans out for microsoft, changing their operating environment so the user experience is the same across all devices desktops / tables & phones, I think they are a little late in the game for this. By the way, who in their right mind buys a Windows phone? 🙂

Anyways doesn’t all of this sound familiar now?  Ubuntu & Unity, the same desktop experience across desktops & phones & tablets, I don’t think that was announced as the original intent for switchig to Unity, but doesn’t it make sense now with the announcement of Ubuntu TV and Ubuntu on the Phone.   If I remember correctly, Ubuntu took their “fair share of flack” from the community for dropping gnome but that’s a story for another post. <Let the Linux Mint Trolls come out of their caves>

Ubuntu on the Atrix2