Thursday, 29 March 2012

Access a remote service localy via ssh

This will be just a short reminder for myself not to forget how to forward a remote service's port to a local one through ssh. Here is the schema:
ssh -i .ssh/ssh_keys/root -L 55432:localhost:5432 root@thinks.iamallama.com
With -i we use a private key to the remote host's user named root at the end. Next we say we want to access a local port -55432- and send the data through that one to the remote port -5432-. We want to use our localhost to address the service which is hosted on the thinks.iamallama.com machine.

This wraps it up. ^_^

Saturday, 24 March 2012

How to cut FLAC with CUE files

I have read the best and simplest procedure for Windows on this forum thread: http://www.head-fi.org/t/547712/cut-a-flac-ape-file-with-the-cue

Here is the recipe:
  1. Get Flac, you just need flac.exe, put it in some directory;
  2. Open the .cue file in Foobar;
  3. Select all the tracks, right-click, choose 'convert', choose '...';
  4. Click 'output format', choose FLAC, click 'edit' and set it to 8;
  5. Click 'destination' and choose your options;
  6. Click 'processing' and make sure 'enable decode...' is off, and 'active dsps' is empty;
  7. Click convert, foobar will ask you were you put flac.exe, navigate to it and voila.
You can use the "bit compare" plugin to make sure the new converted tracks are bit identical to the original ones.

Monday, 12 March 2012

Directory tree in Bash

I was recently searching for a bash script that could be used to create the skeleton of a yaml file containing directory structure. The best material I found is here: http://systembash.com/content/one-line-linux-command-to-print-out-directory-tree-listing/

With the modification of this line:
find ./ -type d | sed -e 's/[^-][^\/]*\//--/g;s/--/ |-/'
I managed to produce the best skeleton:
find ./ | sed -e 's/[^\/]*\// /g'
Since I still have to shape this file up with more data I am not bothering with finding a method to put the ':' at the end of each directory as I can do it myself with little effort. I use Vim's visual mode to get rid of the extra leading spaces at each line.