Nash's world

Tag: Ideas



Reddit URL Harvester

by on Mar.31, 2011, under cool, Programing

snooI was browsing Reddit and I stumbled  upon a small sub-reddit at /r/Earthporn this small conner of Reddit had higres pictures of earth scenery.  From there i was directed to  /r/CityPorn, /r/SpacePorn , /r/MachinePorn/r/AnimalPorn and /r/BotanicalPorn all HD pic. This got me thinking since i am lazy as fuck i did not want to spend every day going through six sub-reddit download and save them the best way to do is to automate the process.

In order to download the images the first thing that needed to be down was to harvest the urls from the sub-reddits home page. I could have gone and screen scraped with beautiful soup but reddit provides this nifty feature where by if you append .json to end of a url eg http://www.reddit.com/r/earthporn/.json it will return the json file for the corresponding page with posts and urls and other data (also if you append .xml it will return and XML file with the pages data ). This allows me to skip all the dirty crud of passing html of a constenly changing page. Below is the version 0.0.1 of URL harvester code.
(continue reading…)

Leave a Comment :, , , , , more...

Order & Chaos

by on Mar.28, 2011, under Art, cool, Musings

Right now, its raining methane on Titan. The planet Uranus, apparently trying to live up to its name, is orbiting the sun sideways, while venus spins backwards. There ares stars exploding, black holes gorging, galaxies colliding.

And here we sit, on a planet pock-marked by collisions, rocked by earthquakes, shaken by storms. a planet doomed to be fried with radiation as its magnetic fields collapse, until finally the sun grows into a red giant and leaves nothing of the Earth but dust.

Here we sit, glasses on over noses, inhalers in our pockets, braces on our teeth, waiting to die as our heart muscles expires, our cells decide to grow forever, or blood vessels just pops and some times in unnatural ways too.

here we sit, and some of us say, behold, look at the order of it all

3 Comments :, , , , more...

The Great Demotions

by on Mar.27, 2011, under Art, cool

Inspiring to say to least. We need more eloquent people like Carl Sagan to save us from the bearded know nothings that want to take us back to stone age.

Leave a Comment :, , , more...


Printing 1 to 1000 without loop or conditionals

by on Jan.03, 2011, under Programing

Print numbers from 1 to 1000 without using any loop or conditional statements.

#include <iostream>
template<int N>
struct NumberGeneration{
  static void out(std::ostream& os)
  {
    NumberGeneration<N-1>::out(os);
    os << N << std::endl;
  }
};
template<>
struct NumberGeneration<1>{
  static void out(std::ostream& os)
  {
    os << 1 << std::endl;
  }
};
int main(){
   NumberGeneration<1000>::out(std::cout);
}
1 Comment :, , , more...


Are you your own grandpa?

by on Oct.09, 2010, under Uncategorized

Let’s say you married a widow, and the widow had a daughter. The widow’s daughter married your dad. That makes your daughter your mother as she is married to your dad.
Now if you had a kid, that kid is a brother in law to your dad, which would be your uncle and also the brother of your step daughter, who is your stepmother.
Ok so now your stepdaughter has a kid, which would be your grandson. This all makes your wife your mothers mother also, or your grandmother. If your wife is your grandmother then you are her grandson. As your grandmothers husband it makes you your own grandpa.

Leave a Comment : more...

Life

by on Oct.03, 2010, under cool

The following fact has been in my mind lately, inspired by something I read on reddit a week or so ago In my body right now, biochemical reactions we call “life” are occurring. It’s cool that they’ve been going my whole life, my heart has done well over a billion beats at this point. That’s cool.But my life processes date back longer than that. My cells grew out of a egg and sperm that came from my mom and dad, and that process was continuous. In other words, they were living before, they came together, rearranged themselves, and kept on going. So in a very real sense, my life is a continuation of my dad’s life and my mom’s — admittedly for only two very lucky cells of theirs. Likewise, their life was the continuation of their progenitors, and so on.In that sense, as a living thing, I’ve been going strong for at least 3.5 billion years. Yes, I used to be simpler, and at various times I’ve narrowed down to just a couple of cells, but through thick and thin, I’ve managed.When I die, it’ll be the end of the line. But 3.5 billion years will have been a pretty good run.

Leave a Comment :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...

IDL

Member of The Internet Defense League