Live data from Hacker News

What you need may be “pipeline +Unix commands” only

nanxiao.me

61–70 of 181 posts

Re: What you need may be “pipeline +Unix commands” only

#61

Case in point from my own recent work: I've been analysing characteristics of Google+ Communities, mostly looking for plausibly active good-faith instances. There are 8.1 million communities in total, and thanks to some friendly assistance, I'd identified slihtly more than 100,000 with both 100 or more members, and visible activity within the preceeding 31 days, as of early 2019. The task of Web scraping those 100k c…

Are you planning on open-sourcing the downloader part? I'm very interested.

Literally just a Bash while-read loop over community IDs. It's embarrassingly trivial.

I'm planning on posting the data, probably to https://social.antefriguserat.de/ and will include procssing scripts.

This is the fetch-script, which saves both the HTML and HEAD responses:

    #!/bin/bash
    
    sample_file=$1
    
    comm_path='community-pages'
    base_url='https://plus.google.com/communities'
    
    i=0
    time sed -e 's,^.*/,,' $sample_file |
        while read commid;
        do
            i=$((i+1))
            echo -e "\n>>> $i  $commid &2;
    
            url="${base_url}/${commid}"
            commfile="${comm_path}/${commid}.html"
            commhead="${comm_path}/${commid}.head"
    
            echo "curl -s -o '${commfile}' -D '${commhead}' '${url}'"
    
        done
The sample file is simply a list of G+ community IDs or URLs, e.g.:

    100000056330101053659
    100000310247038604843
    100000355641542704509
    100000408644688836681
    100000537266485621548
    100000813948204546252
    100001055751908082772
    100001158162744298957
    100001173291703462139
    100001193552641351693

Re: What you need may be “pipeline +Unix commands” only

#63

This article's primary example is a single static text file with 5M lines. Sure, in that case, awk works great, but how often does that come up? In the real world, those 5M lines are growing by several hundred thousand every day, and after a few months, grows beyond what a single computer or awk can handle. Further, users want real-time results, not just a few times a day when your cron script runs. Unix commands are…

> In the real world, those 5M lines are growing by several hundred thousand every day

Or they don’t. Not all data are cloud-scale aggregations.

Re: What you need may be “pipeline +Unix commands” only

#64

This article's primary example is a single static text file with 5M lines. Sure, in that case, awk works great, but how often does that come up? In the real world, those 5M lines are growing by several hundred thousand every day, and after a few months, grows beyond what a single computer or awk can handle. Further, users want real-time results, not just a few times a day when your cron script runs. Unix commands are…

> how often does that come up? It's an important point to remember that a lot of things involved in human society have not exploded in size or complexity in the last 30 years. Many data sets are basically proportional to the human population (health records, criminal records, property records etc), and these have been measured in the millions for 30+ years. In the same time the compute power of a single script has mo…

> Many data sets are basically proportional to the human population.

Awesome point well put.

Re: What you need may be “pipeline +Unix commands” only

#65
post #36

Earlier quoted context omitted.

Well, the article does explicitly say that if you can do this then you don’t have “big data”. Maybe you see TB level processing a lot in your line of work, but most developers never will. Whenever I deal with anything a bit bigger, I break off the smallest section I need to deal with and work with that.

> Maybe you see TB level processing a lot in your line of work, but most developers never will. I doubt this is the case. If you're working on even a medium sized team, you'll see this level of data, whether it's internal server logs, publicly-sourced data, or a variety of other applications. Almost by definition, any company that runs a cluster is probably dealing with TBs of data (otherwise they could probably run…

I have a simple bash script composed of 6 sed commands piped together to convert >100GB csvs (table dumps of recommendation data) into Redis binary protocol which are then ingested into a Redis Cluster using redis-cli --pipe. It takes somewhere around 15 minutes running on a modest bare metal server.

Re: What you need may be “pipeline +Unix commands” only

#66
Unix commands definitely go a long ways.

I've been freelancing for a long time but never automated invoicing people up until recently.

So I combined grep, cut, paste and bc to parse a work log file to get how many hours I worked on that project, what amount I am owed and how many days I worked. I can run these analytics by just passing in the log file, a YYYY/MM date (this month's numbers), YYYY date (yearly numbers) or no date (lifetime).

Long story short, the working prototype of it was 4 lines of Bash and took about 10 minutes to make.

Now I never have to manually go through these work log files again and add up invoice amounts (which I always counted up manually 3 times in a row to avoid mistakes). If you're sending a bunch of invoices a month, this actually took kind of a long time and was always error prone.

Re: What you need may be “pipeline +Unix commands” only

#67
post #37
post #3

Earlier quoted context omitted.

If your data fits on a single harddrive it's not big data. So I would set the current limit to at least 14 TB.

One time I met a company who insisted they were sending tens of TB of data per day and would need multi-PB per year storage compressed. Took one look at the data: All json, all GUIDS and bools. If we just pre-parse it, the entire dataset for a year fits in a few 100s GB uncompressed -- literally could fit on a macbook air for most of the year. The funny thing about "big data" in my experience, is just how small it ac…

> The funny thing about "big data" in my experience, is just how small it actually becomes when you start using the right tools.

Rings way too true for me atm.

My current workplace is currently struggling, because one of our application stores something like a combined 300G of analytics data in the database with the application data. Modifying the table causes hours of downtime because everyone claims that backwards compatible db changes are too hard. And everyone is scared because with more users there's "so much more analytics data" incoming. Yes, with 300Gb across 3-4 years.

And I'm just wondering why it's not an option to just move all of that into one decently sized mysql/postgres instance. Give it SSDs, 30 - 60Gb of ram for the hot dataset (1-2 month) and it'll just solve our problems. But apparently, "that's too hard to do and takes too much time" without further reason.

Re: What you need may be “pipeline +Unix commands” only

#68
post #3

Earlier quoted context omitted.

If your data fits on a single harddrive it's not big data. So I would set the current limit to at least 14 TB.

I thought the boundary point was RAM. It is relativly simple to work with data across multiple drives. When you pass the boundary of being able to work in a single systems RAM, you genneally need a more significant rework

"Big Data is any thing which is crash Excel."

https://twitter.com/devops_borat/status/288698056470315008?l...

Re: What you need may be “pipeline +Unix commands” only

#69

Does this add anything to the Taco Bell post linked in TFA? I suggest changing the link to: http://widgetsandshit.com/teddziuba/2010/10/taco-bell-progra...

TacoBellArticle> I could have done the whole thing Taco Bell style if I had only manned up and broken out sed, but I pussied out and wrote some Python.

That’s cringe-worthy...

Re: What you need may be “pipeline +Unix commands” only

#70
post #6

I feel like the art of UNIX is slowly fading into oblivion, especially with the new generation of programmers/developers. Eventually, they'll become the ones that decide the fate of software engineers (by being hiring managers, etc.) and we'll see more and more monstrosity like the article portraits, instead of cleverly using UNIX tools where applicable. There's so many things that the software world is doing wrong t…

I think it's mostly a matter of chance more than anything else.

If you've jumped straight into programming, you'll probably consider any of those problems as a nail to your C/JS/Java/Python Hammer.

I was lucky to be initiated to the GNU / UNIX toolset by operation folks when doing tech support in a SAAS biz. We were dealing with a lot of text files and it didn't feel right to offload whatever my problem was to them, so I started learning from them and the scripts they wrote.

Mostly trivial stuff, such as in a directory, only select the relevant files, iterate through them to sum up something or find exactly the bit of information you need.

This allowed me to decrease time spent looking for the answer to my current case or colleague's case.

Of course, I then built those functionalities into a .bashrc (or was it bash_profile?) script to help my fellow support folks finding the answer on their own..

Turns out, most people don't want to have anything to do with a command prompt, even if the hard part has been done for you. That's been a pretty good lesson BTW.

Fast forward a few years later to now and I'm realising a good amount of stuff I've been writing lately could potentially be GNU'd instead of writing a Python script.

So that's how it goes I guess.

Post reply on HN