Using curl to download a shortened URL – Dropbox, bit.ly

English: A download symbol.

I was in the middle of an introductory workshop for Data Science at General Assembly and I was talking about using command line instructions to facilitate the manipulation of files and folders. We covered some of the usual ones such as ls, mv, mkdir, cat, more, less, etc. I was then going to demonstrate how easy it was to download a file from the command line using curl and I had prepared a small file uploaded to Dropbox and shortened its URL with bit.ly.

“So far so good” – I thought – and then proceeded with the demonstration… Only to find out that the command I was using was indeed downloading a file, but it was the only downloading the wrapper html created by bit.ly for the re-directioning…  I should have known better than that! Of course all this happening while various pairs of gazing eyes were upon me… I tried again using a different flag and… nothing! and again… nothing… Pressure mounting, I decided to cut the embarrassment short and apologised. Got them to download the file in the less glamorous way by using the browser…

So, if you are ever in that predicament, here is the solution, use the -L flag with curl:

$ curl -L -o newname.ext http://your.shortened.url

The -L deals with the redirectioning of the shortened URL and make sure that you use the -o flag to assign a new name to your file.

E voilà!

What is data science?

Venn Diagram

Talking to some friends from General Assembly, I ended up being asked to provide a brief quote about what data science is and given the short amount of time to think about the question I ended up with the following:

“Data science and analytics are rapidly gaining prominence as some of the more sought after disciplines in academic and professional circles. In a nutshell, data science can be understood as the extraction of knowledge and insight from various sources of data, and the skills required to achieve this range from programming to design, and from mathematics to storytelling.”
I am convinced there is more to it than the above lines, but I was asked for a small quote. Anyway, what do you think?

All Watched Over by Machines of Loving Grace

This is the title of the 1967 poem by Richard Brautigan and of course that is the name of the great three-part documentary by Adam Curtis. If you haven’t watched it, please do yourself a favour and take a look.

All Watched Over by Machines of Loving Grace

by Richard Brautigan

I’d like to think (and
the sooner the better!)
of a cybernetic meadow
where mammals and computers
live together in mutually
programming harmony
like pure water
touching clear sky.

I like to think
(right now, please!)
of a cybernetic forest
filled with pines and electronics
where deer stroll peacefully
past computers
as if they were flowers
with spinning blossoms.

I like to think
(it has to be!)
of a cybernetic ecology
where we are free of our labors
and joined back to nature,
returned to our mammal brothers and sisters,
and all watched over
by machines of loving grace.