Archive

Posts Tagged ‘linux’

Extracting M2TS length from a BDMV directory in Linux

January 14th, 2010

I was having the hardest time getting various programs to echo the runtime of m2ts files in Linux, and it turns out someone wrote a parser for the files in the BDMV/PLAYLIST directory, which have all of this information.

  • Get bdtools. I got Version 1.4. You can find it here.
  • ./configure && make && sudo make install
  • Try running mpls_dump. I got this error when running:
    mpls_dump: error while loading shared libraries: libbd-1.0.so.1: cannot open shared object file:
    No such file or directory

  • To fix it, do this:
    echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf
    sudo ldconfig


Uncategorized , , , , , , , , ,

Installing PARI-GP under OpenSUSE 11.2

January 11th, 2010

I have no idea why this package isn’t in the default community repositories. I highly recommend they add it. Use the following commands to add the repository and install the package:


sudo zypper ar ftp://ftp5.gwdg.de/pub/opensuse/repositories/home:/mkng:/science/openSUSE_11.1/ PARI
sudo zypper in pari-gp


Uncategorized , , , , ,

Calibre with the Nook on Ubuntu

January 1st, 2010

Calibre is about the best thing since sliced bread. It is able to convert basically any type of Ebook format into EPUB, which is what my Nook reads natively. It seamlessly syncs with the Nook as well, which is a huge plus, and all of this happens in Linux. I highly recommend this software. Just make sure not to queue up too many jobs, or it might DOS your computer for a bit. The PDF conversion is especially intensive. It makes quick work of short documents (hundreds of pages), but documents that are thousands of pages take much, much longer. The only capability I’m missing currently is conversion of DOC to EPUB, but I can use OpenOffice to convert a DOC to HTML, and then import that into Calibre and convert it, so that works.


Uncategorized , , , , , , ,

Fixing italics in Calibre EPUB output

December 31st, 2009

I converted an ebook from TXT to EPUB today using Calibre, and found that the italics (which in the TXT file are annotated /like this/) are not converted into the HTML equivalent.  I did the following to fix this:

  1. unzip ebook.epub -d tmpbook
  2. cd tmpbook
  3. perl -i.bak -pe 's/([\s-,.;\'?:]+)\/(.+?)\/([\s-,.;\'?:]+)/$1<i>$2<\/i>$3/sg;' *html
  4. That will create.bak files just in case anything went wrong.  To revert the changes, do this:
    for i in *.bak; do mv $i ${i%.bak}; done
  5. zip -r ebook.zip * && mv ebook.zip ebook.epub

Then, I found out Calibre works beautifully with the Nook, so I just popped it on there and it worked.

Uncategorized , , , , ,

Compiling ConvertLit on Ubuntu Linux 9.10

December 31st, 2009

So, ConvertLit seems to be a good solution for those looking to convert LIT ebooks into EPUB (well, into HTML, but then into EPUB…).  Unfortunately, the developers seem to be unable to properly make a good source tarball for version 1.8.  Here’s what I did:

  1. Download Version 1.8 source from here.
  2. unzip clit18src.zip -d convertlit
  3. sudo apt-get install libtommath-dev
  4. Download this to the convertlit directory.
  5. patch -p1 -i clit18.source.patch
  6. You should see the clit18/Makefile was patched
  7. cd lib && make && cd ../clit18 && make
  8. the clit binary should be available in the clit18 directory
  9. sudo cp clit18/clit /usr/local/bin/
  10. Use it!

Now I just have to figure out how to convert it to epub.

Uncategorized , , , , , , ,

Kopete Chat Window History is annoying

November 27th, 2009

I’ve been using Kopete on my quest to convert to KDE, and I’ve been extremely annoyed by previous conversions showing up in my chat windows. The option to disable it didn’t seem to be anywhere, but I found a forum post that pointed me to the Plugins section of the configuration.

Kopete Annoyance

Just disable the plugin entirely or open it and mess with the configuration. Things like that shouldn’t be on by default, along with chat window tabs (when did this become common?) and annoying buttons for fonts and emoticons. But, maybe I’m more minimalistic than many.

Uncategorized , , , ,

Getting Skype Working on Ubuntu 9.10 Karmic x86-64

November 19th, 2009

So, recently, I installed Ubuntu karmic cleanly on my main desktop machine here at home, and I have really liked it. I even switched to KDE, and everything has been working better than it had been in GNOME. I tried setting up Skype the other day, and ran into an issue with the microphone. It turns out that since the new Skype uses PulseAudio, there’s a further configuration step that’s not so obvious. I found out here that you have to do the following:


sudo apt-get install pavucontrol
pavucontrol

Then, go to the Input Devices tab, and unmute the sound (click the little speaker with a red X until the controls at the bottom are enabled). Then, change the Port setting until you can see the bars move when you tap the microphone. Then try Skype. This worked perfectly for me – it’s too bad it’s not connected to the KDE sound mixer, but oh well. Maybe in the future that will happen.

Uncategorized , , , , , , , ,

SMPlayer, Lirc, and IRExec on Ubuntu Karmic

November 7th, 2009

I used to use lirc with mplayer to allow my Packard Bell crappy remote to work awesomely, but I have since lost that configuration and switched to smplayer, since it’s awesome.  Today, I figured out how to control smplayer using similar means.

Read more…

Uncategorized , , , , , , ,

Importing MySQL 1.4 Amarok data into Amarok 2.2 Nightly

September 28th, 2009

I was having a bunch of trouble today importing my old MySQL amarok database into the new nightly version of amarok I installed.  The Amarok Wiki had a great section on how to convert a MySQL Amarok collection into an SQLlite one.  This was the key to importing my old 1.4 collection into the new 2.2 nightly version of Amarok.

Uncategorized , , , , , , ,

1,000,000th Fibonacci Number One-Liner in C

September 9th, 2009

This is possibly the best one-liner I’ve ever written:

gcc -x c -o /tmp/out - -lgmp <<< '#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <gmp.h>
void omg_i_love_leonardo_of_pisa(uint32_t num, mpz_t * result) { mpz_t retval, last, tmp; mpz_init(retval);
 mpz_init(last); mpz_init(tmp); uint32_t i = 1; if(num == 0) return; mpz_set_ui(retval, 1U);
mpz_set_ui(last, 0U); for(; i < num; i++) { mpz_set(tmp, retval); mpz_add(retval, retval, last);
mpz_set(last, tmp); } mpz_set(*result, retval); } int main() { uint32_t num; mpz_t fibo; mpz_init(fibo);
omg_i_love_leonardo_of_pisa(1000001, &fibo); mpz_out_str(stdout, 10, fibo); printf("\n"); return 1; }
' && time /tmp/out

It compiles a C program given from STDIN, puts it in /tmp/out, and runs it with time to find the time it takes to run. It generates the 1,000,000th Fibonacci number. Try it!

Uncategorized , , , , , , ,