Thursday, October 11, 2012

Kernel mainline ppa downloader (aka kmpd / kmp-downloader)


About

kmp-downloader is a simple program that allows you to install fresh new kernel versions from the ubuntu kernel mainline ppa.

As it is, the mainline is not an actual "ppa" (personal package archive) and doesn't allow people to use apt-get to upgrade.

Requirements

You may need python beautifoul soup (python-bs4) or execute:
sudo apt-get install python-bs4

How to use it

You may download it using this quick link: https://github.com/medigeek/kmp-downloader/tarball/master

Save the archive and extract the files. Double click on kmpd.py (execute in terminal). If you're not sure about an option, press Enter and it will select the default answer.

You may also execute this command (one-liner):

cd /tmp; rm -rf medigeek-kmp*; wget --no-check-certificate https://github.com/medigeek/kmp-downloader/tarball/master -O kmpd.tar.gz; tar xzf kmpd.tar.gz; cd medigeek-*; python kmpd.py

You will be asked a series of questions, where you either reply by "Y" or "N" (yes or no) or simply press enter and let the program figure out the default reply (mentioned in square [] brackets). It will then install the appropriate debian packages.

Note: it will not fix the problems with other packages. I suggest running linux ppa packages without dkms package (without closed source packages like nvidia driver or virtualbox driver), in order to have a smooth, errorless installation.

Uninstall

To uninstall the kernel packages, remember to boot to a different kernel image first. Then you can use your favourite package manager to uninstall the packages.

If you prefer the command line, if you installed version 3.5.3, you can uninstall it using this command:

sudo apt-get purge linux-image-3.5.3.* linux-image-extra-3.5.3.* linux-headers-3.5.3.*


Thursday, July 26, 2012

python: download url to file with progress bar

This is an alternative answer for a question on stackoverflow:
http://stackoverflow.com/a/22776/286994

I modified the answer a bit, using .format instead of % string formatting and sys.stdout.write(), and posted it on gist github: https://gist.github.com/3176958

#!/usr/bin/python
# Improve http://stackoverflow.com/a/22776/286994
# (using .format() instead of % string formatting)

import sys
import urllib2

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print("Downloading: {0} Bytes: {1}".format(url, file_size))

file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    p = float(file_size_dl) / file_size
    status = r"{0}  [{1:.2%}]".format(file_size_dl, p)
    status = status + chr(8)*(len(status)+1)
    sys.stdout.write(status)

f.close()

I'm using this solution for the kernel mainline ppa downloader: https://github.com/medigeek/kmp-downloader

Monday, April 02, 2012

Hiren's boot cd using unetbootin (missing boot options)



If you try to use unetbootin to copy Hiren's bootcd on a usb flash drive and you boot using the flash disk, you'll notice that some options are missing, especially the "mini windows xp" boot option.

To overcome this problem you have to copy the file "HBCD/isolinux.cfg" to the main folder and replace the file "syslinux.cfg"

Then everything will work as expected.

Bug report: https://bugs.launchpad.net/unetbootin/+bug/971403

Monday, March 05, 2012

Now you can read xps files in ubuntu!

About
  OpenXPS or XPS stands for XML Paper Specification. It is based on XML and it's a new electronic paper format originally developed by Microsoft and it serves as a PDF alternative. XPS files are usually created using "Microsoft XPS Document Writer" in Windows environments. It is now standardized as an open standard document format.

Quoting Wikipedia:
 An XPS file is in fact a Unicoded ZIP archive using the Open Packaging Conventions, containing the files which make up the document. These include an XML markup file for each page, text, embedded fonts, raster images, 2D vector graphics, as well as the digital rights management information. The contents of an XPS file can be examined simply by opening it in an application which supports ZIP files.

 The OpenXPS document format specification supports features such as color gradients, transparencies, CMYK color spaces, printer calibration, multiple-ink systems and print schemas.

 Evince already supports xps, but it has to be compiled with that option enabled. In order for evince (the program that allows you to read pdf document files) to read xps files, libgxps is required first.

Status update
..for libgxps in Debian (we'll see about Ubuntu afterwards):



There's a PPA!
After much frustration, I have created a PPA for evince with xps: https://launchpad.net/~medigeek/+archive/evince-xps/

Note: The evince version in Ubuntu 11.10 oneiric ocelot doesn't work with xps (segmentation fault when opening the file) and there are several packages to be backported. I've decided not to backport it. It works in Ubuntu 12.04 precise pangolin.
If you need to read an xps file, package libgxps-utils provides enough conversion tools, e.g. command:
xpstopdf myfile.xps

Friday, March 02, 2012

Libreoffice recent documents - History manager extension

This solution works for Windows operating systems as well as Linux distributions (It's actually system independent)
If you need to clear or define how many items the recent documents list bears, you can install this easy-to-use extension/addon/plugin: History manager for Libreoffice/Openoffice

- Click "Get it" and download the .oxt file.
- Open Libreoffice writer, menu > Tools > Extension manager > press Add and open the .oxt file you've downloaded.
- Close Libreoffice and re-open it. Go to menu Tools > Add-ons > History manager