So I mainly use Linux, but for some tasks I turn to Windows. In this particular case it was setting up my iPad so that my wife could take it to Spain with her, packed with movies, to entertain the kids. This included the use of iTunes. I’m sure there’s some way to make it work in Linux as well, but I thought I’d write a post based on a solution I found in Windows, for once.

I needed to convert existing .avi-files to the format the iPad uses. This is where the program Handbrake comes into play. It’s excellent for converting from one format to another, but it’s the batch-convert part that isn’t too good. So how to solve this? Well, first install Handbrake, then proceed to create a .bat-script in the directory that contains the .avi-files. I do realize that Handbrake has a Add to queue function, but that sort of takes away the point of batch-converting. Rather I specify a folder, then it convert every file in it, than me adding a file manually one by one.

Open up Notepad, and place the following bit of text in it:

1
FOR /F "tokens=*" %%G IN ('DIR /B /S *.avi') DO "C:\Program Files\Handbrake\HandBrakeCLI" -i "%%G" -o "%%G".mp4 --preset="iPad"

When saving the file, remember to select All files on the Save as type-field. Then type in script.bat in the File Name field.

So when you’re done with this, it’s just a case of double-clicking the script to batch convert all of the .avi-files in the directory the script is placed in.

Oh, another word of advice. Make sure your Windows-machine doesn’t hibernate or go to sleep. I learned that the hard way.

Most people these days use google.com as their preferred search engine, and most times a regular search will bring you the results you are looking for. But what if you want a more complex search? Or want to filter out some results? Well, here’s a few pointers on how to Google a bit more efficiently, and some other neat tricks.

A regular search

Say that I want to search for a review for the cellphone HTC Desire Z. I could always use the string “HTC Desire Z review”. Or, we could do a more efficient search.

Take the following search string as an example:

site:engadget.com ~review "htc desire z" -amazon 2010..2012

Let’s break it down:

  • site:engadget:com - Only searches the pages of the site engadget.com
  • ~review - Also searches related words, such as “check, examine, opinion”.
  • htc desire z - Searches for the exact phrase, and not each word separately.
  • -amazon - Excludes this term from the search.
  • 2010..2012 - Shows all results from within the specified timerange.

The last element above not only works with a time-range, but also with any other type of range. For instance:

  • $100..$200

..gives you results based on a range from $100 to $200.

Searching for filetypes

In certain cases you want to search for specific types of file. For instance,

filetype:pdf linux intitle:best *distribution

Again, let’s break this down:

  • filetype:pdf - Searches only results of the file type you specify. .doc, .jpg, .torrent, the options are endless. Close to, anyway.
  • linux - Just a regular search string.
  • intitle:best - Only shows results with that word in the title (in this case, ‘best’)
  • *distribution - Replaces itself with common terms in your search (in this case ‘Arch Linux distribution’, ‘Red Hat distribution’, will both be searched, among many others)

Definitions

To find the definition of a word, use:

define: exquisite

Unit converter

Converting from one unit to another made easy:

Distance

54 km to miles

Weight

2 kg to lbs

Currency

150 NOK to USD

Calculator

Also works great as a calculator:

20*(2+4)/5-1

Time

Check out what the time is in another part of the world:

time Hong Kong

Weather

Also handy for checking the weather:

weather Oslo

Just a few of the things one can do with the Google search engine!

If you, like me, find yourself SSH’ing all day long, this little piece of code will do wonders. Well, it’ll save you some keystrokes at least. This line parses your .bash_history-file and tries to autocomplete the host you are trying to SSH to, given that you’ve already used SSH to access the host in question at least once before.

So, to make this work, place the following in your .bashrc or .bash_profile file:

1
complete -W "$(echo $(grep '^ssh ' .bash_history | sort -u | sed 's/^ssh //'))" ssh

Once that’s done, either log out, and in again, or type:

1
source .bashrc

..to apply the change made to your .bashrc, if that’s the file you’ve made the change to. You should now be able to autocomplete hosts when SSH’ing with TAB.

Update: I am also (now) aware of, thanks to my colleagues, that you have to tweak and sometimes install additional packages to have a similar functionality provided by your system’s package manager. I find the solution above the easiest one, as it’s only a single line that needs to be included in a file, without any additional tweaks or packages necessary. But in the end, it’s your call!

Skulle du ønske å høre på P4 sin nettradio uten å måtte ha et nettleservindu åpen, kan du bare peke din mediaspiller (som f.eks. vlc eller mplayer) direkte til strømmen. Hvis vi bruker mplayer:

For P4:

1
mplayer mms://mms-cluster2.nextra.no/P4_Norge

For P4 Bandit

1
mplayer mms://mms-cluster2.nextra.no/P4_bandit

Bare erstatt mplayer med vlc, eller noe annet, skulle du ønske å endre mediaspiller som benyttes.

For a couple of weeks now I’ve been exercising, and can honestly start to feel some difference. It’s tough, I’m a big guy, and things take time, but little by little I’ve begun to make changes in my life that hopefully will improve my health, and my struggle with depression. After training, I get a whole new feeling of tired. Not the kind of tired you feel after you’ve sat all day next to a computer, but your body actually telling you that you’re physically tired, and once you get to relax after working out, it’s a like a pat in the back, a “job well done”, if you will.

Now, as I’ve been making these changes in my life, I’ve begun to look towards meditation. Some say it works, other say it doesn’t. I choose to believe that it does, and several medical studies are able to back that claim, just have a look at http://en.wikipedia.org/wiki/Research_on_meditation. Supposedly it help to improve your health, concentration, and is even able to reduce pain! Imagine that.

The book I’ve been reading is called Mindfulness In Plain English, and is written by Bhante Henepola Gunaratana. I’ve already read through this book once, and I find it easy to understand. I’ve tried meditating a couple of times, and it’s more difficult than you think! There’s particularly one analogy that I enjoy:

Our mind is analogous to a cup of muddy water. The longer you keep a cup of muddy water still, the more mud settles down and the water will be seen clearly. Similarly, if you keep quiet without moving you body, focusing your entire undivided attention on the subject of your meditation, your mind settles down and begins to experience the bliss of meditation.

If anyone should have any tips or guidelines as to what I should/should not do to improve my meditation, I would really appreciate it!

Now, before ending this post, let me just mention that the book I’ve mentioned is available for free! Just head over to http://www.urbandharma.org/udharma4/mpe.html for the online version. It’s also available as a PDF and in the .epub format.

Enjoy!