Install pianobar and run it under proxy server “tor”

Why Pianobar

Well, do you know Pandora uses flash? if you open their web in your browser then your system is going to cry! and if you have less resource memory & CPU like then you won’t like flash in your browser.

There are more issues, like the web plays adds and audio has low bit-rate i.e., low quality. If you need high quality music i.e., 190 kbps and without any adds then you need a subsription.

But you can luckly get rid of adds and get high bit-rate audio via Pandora API. Here comes Pianobar, a free command line based client that does all you need.

Again, I followed few blogs to get it running, few of them are here; Instructables,

On linus

sudo apt-get install pianobar

on Mac

Easier way is to use either MacPorts or Homebrew. To install via MacPorts to the following

sudo port install pianobar

I’ll guide you to use Homebrew. first install Homebrew source

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew install pianobar

If you get error on the above installation then may be the link is dead and you need to get the updated URL. People also use different way to install them, here is another way. source

curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

Compile manually; first install depenties and then Pianobar according to this soruce

sudo port install libao faad2 libmad cmake git-core
git clone git://github.com/PromyLOPh/pianobar.git
cd pianobar
cmake . && make && sudo make install

Now you can launch Pianobar with

pianobar

It’ll ask you to enter user name and password, following station name, like below

Welcome to pianobar! Press ? for a list of commands.
[?] Username:
[?] Password:
(i) Login… Ok.
(i) Get stations… Ok.
0) some name Radio
1) some name Radio
2) some name Radio
3) some name Radio

[?] Select station:

After the login you can press ? to view the action keys, like pressing n can choose next song.

Configure Pianobar

We can configure Pianobar with user name and password in a text file where we could also specify to use proxy and even more. By default Pianobar will look for a configuration file under ~/.config/pianobar/config, so all we have to do is to create a config file in that location.

Create .config under your home directory like below if you don’t have one.

mkdir -p ~/.config/pianobar
cd ~/.config/pianobar
touch config
nano config

Let’s add some details to the cofig file

tls_fingerprint = 2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0
user = myemail@mail.com
password = mypassword

At this moment I don’t have more details on tls_fingerprint, but may be in future I’ll have some.

If you run pianobar on your terminal, it’s going login automatically, wow! that’s nice. Still we can do more here, let’s move on further.

Run under Proxy

If you are located outside of US then you want to use free/paid proxy server to get access to Pandora, look at my previous post deals with free proxie servers. Remember that Pianobar can handle http proxy but not the SOCKS.

Add the following at the bottem of your config file.

control_proxy = http://xxx.xxx.xxx.xxx:80

Replace xxx.xxx.xxx.xxx with the IP your found on free proxy sites and also the port number 80. Now you should able to use Pianobar from outside of US.

Ok, that looks fine, but hey! don’t you think it’s silly to edit config file on every launch?, yes it’s. There is work around for this, you can configure tor to automatically pickup the proxy.

Configure tor

For installing tor look at my earlier post, if you run it then you’ll see something like below on ~5-th line;

[notice] Opening Socks listener on 127.0.0.1:9050

So you could cofigure your Pianobar to listen to port 9050, you may expect it’s all done, but it’s not going to work because tor works on SOCKS and Pianobar doesn’t handle SOCKS and required http proxy. So what we are going to do? there are scripts around which does listen to SOCKS and forwards it to http proxy. It was very hard for me to get one working. I was trying pianobarproxy, delegate, Polipo and few more. None of them worked initially but I found a working method with Polipo and I’ll explain you here. It’s taken from different resources found here and in superuser.Install Polipo from Homebrew.

brew install Polipo

Now we need to configure Polipo to listen to tor’s port 9050 and forward it to localhost. Create a text file anywhere with the following info,

socksParentProxy = 127.0.0.1:9050
diskCacheRoot=""

Now we can tell Polipo to use this configuration file as belwo.

polipo -c ~/Downloads/config.txt

You can also add configuration file to the location /etc/polipo/config then you don’t need to specify the configuration file (source). You can also find a template here. You can do this as below.

cd /etc
sudo mkdir polipo
sudo touch config
sudo nano config

In nano editor copy and the paste the follwing and press ctrl+o and ctrl+x.

socksParentProxy = 127.0.0.1:9050
diskCacheRoot=""

Remember that Polipo default listening port is 8123 and we have add this port to Pianobar config file. Add this info.

control_proxy = http://127.0.0.1:8123

We all done, open three tabs on terminal, on one type tor, in the next one type the above Polipo command and in the last tab type pianobar, you must see Pianobar running.

Advertisements

Listen to Pandora from outside of US with proxy

Pandora: an internet radio can play music similar to the song or artist you like. Basically it creates a station based on your interest and plays similar songs, the more interesting part is you can say “I like this or don’t” even you can say “I tired of this” then Pandora puts on the shelf for a month. So Pandora helps you to find music of your interets.

I’m going to explain you the possible ways to access Pandora outside of US, more importantly the free approach.

Proxy servers

The best way is to use free proxy servers. Hidemyass is a good place for free proxies, but it’s tedious to configure your browser on each instance. Mediahint provides a browser plugin which automatically sets the proxy when you visit Pandora, so you don’t need search for free proxies and configure browser.

Use tor

Here I’ll walk through the installation and configuration of tor on mac and must be easier on Linux. On mac install tor from Homebrew (if you don’t have Homebrew then install it first).  I followed to OpenPandora to configure tor, this is a good place to keep eye on the discussion area.

brew install tor
cd /usr/local/Cellar/tor/0.2.3.25/etc/tor
touch torrc
nano torrc

The above method to use Homebrew sometime ends on error like couldn’t link libevent, so the alternative way to install tor is to use MacPorts as below.

sudo port install tor

Now we need to configure tor as above and the easier way to find the location for configuration file is to run tor and now you’ll see tor will say Configuration file"/opt/local/etc/tor/torrc" not present, so we got the location.

cd /opt/local/etc/tor/
sudo touch torrc
sudo nano torrc

Add the following to the nano editor and press ctrl+oenter and ctrl+x. note: I need exitnode to land in US.

StrictExitNodes 1
ExitNodes {US}

Exicute tor, now you can see tor starts running and look at nearly fifth line as below, it must be giving you output with local host (127.0.0.1) and port number on which tor is forwarding.

tor
......
......
[notice] Opening Socks listener on 127.0.0.1:9050

It’s important to note that it’s not a http proxy rather it’s socks, so you need to configure you browser to use socks proxy on port 9050, enjoy!

In the next post I’ll explaing you “how to configure pianobar to listen to Pandora.”

Link_Back-Chemdraw_&_Nisus writer

&

As I’m a chemist as well as I had switch from windows to mac, I had and having few issues with mac OS. One of them is roundtrip editing of chemdraws in between word processor and chemdraw program. Also CPU and memory hook with MS-Word. I hope now this problem is solved with Nisus writer. I would say it’s an excellent word processor and I would suggest people to start using it rather than using MS-Word.

There is a pool on macresearch website (on bottom right corner) where you can pool as well as comment on the importance of this roundtrip editing as a chemist.

Tweak chemdraw tools with your favorite key

Being a advance user in chemdraw, our hands are always focusing to do less work and get more job done. Ofcourse many people already know about how to utilize the chemdraw shortcut keys (for those who is not familiar look at this link). I have modified the shortcut key script file in order to assign a key for a particular action. The interesting information for you is that we can assign a key to involve chemdraw tool, which could be one of the draw back of chemdraw.

It’s pretty easy to assign key, For example, I have assigned key “d” for Lasso and “q” for eraser tool. You can download my edited script file from here and look at them. Drop a message here, if you need more information.

Note: I did this only in mac chemdraw but not in microsoft windows and I don’t have answer about will it the same in windows or not. The hotkey.plist file can be found in /cschemdraw/chemdraw items/

Geektool: Virtual Desktop Enhancement

I have really grabbed a huge amount of shell scripts in the past two days and I’ll give you here my experience on Geektool (with all my grabbed scripts).

What it’s GeekTool

It’s actually a preference panel and creates a layer over the desktop which can be utilized to place picture, text file and shell script output. Most of the people use the last one (shell script output) to monitor their system like cpu hogger, etc

How to install?

Follow the link here and it gives you excellent screenshot tour

Here’s my screenshot

Click here to see more information of the Screen shot

please follow this link to get complete information

Chemistry-dictionary integration to word processor or OS

As a chemist, we are often frustrated by seeing red underlines while writing chemistry texts in word processor, text editor, etc. A very good example seen in thesis writing, countless red underlines can be seen.

Recently, a small group made chemistry dictionary, which contains thousands of chemistry terms and it can be easily integrated to word processors, like Microsoft word, openoffice, iwork, etc.

Here’s the direct download link

I have included few more chem terms which is not included in the above link, you can downloaded my list from here.

Installation: word processors (Windows/Mac/Linux)

Please read the file “install.txt” in the downloaded file

Mac users: you can integrate to the OS, download the file from here

copy the file “en” and paste it in ~/library/spelling

In case that you already have the file “en” in the directory (~/library/spelling), then open the en file (the one which you downloaded) with textedit, copy and paste the contents into the en file which is already there in you directory (~/library/spelling).

Note: again I made my own chem term file for mac (combined the original file and my additional chem terms), however my mac couldn’t read it properly and hangs often, so I removed the file from ~/library/spelling.

Please read the original post, if you have any problem in configuration.

Source: Chemistry-blog

Hide unhide your files (Mac OSX tip)

you can’t do this from finder. it has to be done from terminal.

To unhide: chflags hidden (path of file or folder)

To unhide: chflags nohidden (path of file or folder)

replace (path of file or folder) with unix path of your file or folder. The easiest way to do this is to drag the file or folder to the terminal window.

——————————————————————————————————–
To view the hidden file or folder

go to finder: press Shift+command+G together (make sure you are in the same directory where hidden file or folder located), it pops a window, give the name of hidden file or folder, that’s it now you can see it.

To view the hidden file or folder from any location

press Shift+command+G together, give the name of hidden file or folder with full path (eg: /Users/xxxxx/Desktop/music.txt).