Wednesday 29 October 2014

Impressive pandas python web data code snippet from stack overflow.

import itertools
import datetime as dt

import numpy as np
import pandas as pd
from pandas.io.html import read_html


dfs = read_html('http://www.epexspot.com/en/market-data/auction/auction-table/2006-01-01/DE',
                attrs={'class': 'list hours responsive'},
                skiprows=1)

df = dfs[0]

hours = list(itertools.chain.from_iterable([[x, x] for x in range(1, 25)]))
df[0] = hours

df = df.rename(columns={0: 'a'})
df = df.rename(columns={1: 'b'})
df = df.set_index(['a', 'b'])
#df = df.set_index([0, 1])

today = dt.datetime(2006, 1, 1)
days = pd.date_range(today, periods=len(df.columns), freq='D')

colnames = [day.strftime(format='%Y-%m-%d') for day in days]
df.columns = colnames

Wednesday 22 October 2014

Disk usage (du) sorted by human readable size:

From https://gist.github.com/xentek/3490293

du -s ./* | sort -n| cut -f 2-| xargs du -sh {}

Monday 20 October 2014

Great post on ssh and .ssh/config including port forwarding

http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/

Saturday 18 October 2014

full screen ubuntu in an oracle vm

Day 1: Sort it.  A search, a line in the terminal, done.

Day 2:  New VM.  A search.  NO JOY.

Day 3:  New searches.  I find it again.

How can it be so damn hard?!

Anyway, in the VM: 

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11


Thank you. No big deal. No freaking mouse clicks. No idiocy.

Friday 3 October 2014

From http://www.huffingtonpost.co.uk/2014/10/01/8-vegetarian-quotes-world-vegetarian-day_n_5912360.html?utm_hp_ref=mostpopular

Earth provides enough to satisfy every man's need, but not every man's greed.  Mohandas Gandhi.

If slaughterhouses had glass walls, everyone would be a vegetarian.  Paul McCartney.

Flesh eating is unprovoked murder.  Benjamin Franklin.

A man can live and be healthy without killing animals for food; therefore, if he eats meat, he participates in taking animal life merely for the sake of his appetite.  And to act so is immoral.  Leo Tolstoy.

My body will not be a tomb for other creatures.  Leonardo Da Vinci.

However scrupulously the slaughterhouse is concealed in the graceful distance of miles, there is complicity.  Ralph Waldo Emerson.

There is no fundamental difference between man and animals in the their ability to feel pleasure and pain, happiness, and misery.  Charles Darwin.

Nothing will benefit human health and increase the chances of survival of life on earth as much as the evolution to a vegetarian diet.  Albert Einstein.

Need a quote incriminating all those who argue against it, too.....  Idiots.  Assholes.