Live data from Hacker News

Show HN: Pythonpy – the swiss army knife of the command line

github.com

21–30 of 45 posts

Re: Show HN: Pythonpy – the swiss army knife of the command line

#21
post #17

I like it! Now I can count the number of files I have in a directory: ls |py -l 'sum(1 for x in l)' And also I can count the number of files whose names matche a certain extension: ls |grep .py |py -l 'sum(1 for x in l)' I am not saying it was not possible before, but I don't know how to do it in bash. Looking forward to use that for some basic stats on file. The following should sum up the first column of a csv. cat…

The first two can be done with wc:

  ls | wc -l
  ls | grep .py | wc -l

Re: Show HN: Pythonpy – the swiss army knife of the command line

#22
post #17

I like it! Now I can count the number of files I have in a directory: ls |py -l 'sum(1 for x in l)' And also I can count the number of files whose names matche a certain extension: ls |grep .py |py -l 'sum(1 for x in l)' I am not saying it was not possible before, but I don't know how to do it in bash. Looking forward to use that for some basic stats on file. The following should sum up the first column of a csv. cat…

[deleted]

Re: Show HN: Pythonpy – the swiss army knife of the command line

#23
post #17

I like it! Now I can count the number of files I have in a directory: ls |py -l 'sum(1 for x in l)' And also I can count the number of files whose names matche a certain extension: ls |grep .py |py -l 'sum(1 for x in l)' I am not saying it was not possible before, but I don't know how to do it in bash. Looking forward to use that for some basic stats on file. The following should sum up the first column of a csv. cat…

You'll probably want to learn the regular unix way as well. Tools like this are nice, but you're already 99% there as it is for most things.

    ls | wc -l

    ls | grep -c .py
(note the cat and pipe are not needed)

    awk -F',' '{sum+=$1}END{print sum}' data.csv

Re: Show HN: Pythonpy – the swiss army knife of the command line

#24
post #11
post #7

You should put up a donation link. If more people do that and it becomes common practice to donate to useful open source tools / projects then imagine what more awesome stuff could be created. Many people desire to build tools but don't have the financial support to do so.

This is what gittip is for. And Kickstarter/Indiegogo/Crowdfunding has shown genuine interest to help fund useful tools and libraries lately which is great.

I think if Git Tip had a button on a GitHub repo (a la Heroku button), this would be amazing.

Re: Show HN: Pythonpy – the swiss army knife of the command line

#25

Earlier quoted context omitted.

Can't disagree more. That completely misunderstands the motivating philosophy behind effort expenditure given to FLOSS. It isn't about motivating people to do things; that creates abandonware. It is about solving a problem that needs solving.

I'm confused by this. How does contributing money to people developing software for the commons lead to abandonware? And is abandonware a problem if it is free/open-source? Should I avoid publishing my hobby projects that I'm not planning to support?

It encourages people to start up projects just to get the contributions, then abandon the projects when the initial stream of contributions dries up. Yeah abandonware is a problem for people who start to use it thinking there is a community of some sort behind it, and then are stuck with supporting it all on their own or having to find something else. Fortunately such projects are normally easy to spot once you've been burned a few times. Unfortunately they comprise 95% of what's on github.

Re: Show HN: Pythonpy – the swiss army knife of the command line

#26
post #23
post #17

I like it! Now I can count the number of files I have in a directory: ls |py -l 'sum(1 for x in l)' And also I can count the number of files whose names matche a certain extension: ls |grep .py |py -l 'sum(1 for x in l)' I am not saying it was not possible before, but I don't know how to do it in bash. Looking forward to use that for some basic stats on file. The following should sum up the first column of a csv. cat…

You'll probably want to learn the regular unix way as well. Tools like this are nice, but you're already 99% there as it is for most things. ls | wc -l ls | grep -c .py (note the cat and pipe are not needed) awk -F',' '{sum+=$1}END{print sum}' data.csv

Ah! I haven't thought of using wc, although I frequently use it to count the number of lines in my code. For awk, yes, I have to learn it. Thanks to you and the others who gave the example in bash.

Re: Show HN: Pythonpy – the swiss army knife of the command line

#27
I usually use Python(or another lang's interpreter) as my calculator, so this will save me a few keystrokes in the future. I think I'll still use short scripts rather than the command line to do more involved things (like find long palindromes in a txt file), but this will save me a bit of time when doing quick calculations. Thanks!

Re: Show HN: Pythonpy – the swiss army knife of the command line

#30
post #26
post #23

Earlier quoted context omitted.

You'll probably want to learn the regular unix way as well. Tools like this are nice, but you're already 99% there as it is for most things. ls | wc -l ls | grep -c .py (note the cat and pipe are not needed) awk -F',' '{sum+=$1}END{print sum}' data.csv

Ah! I haven't thought of using wc, although I frequently use it to count the number of lines in my code. For awk, yes, I have to learn it. Thanks to you and the others who gave the example in bash.

Technically this will work on any shell not just bash but good luck! Shell scripting is rather fun once you get the hang of it. Though if I'm honest, if I get a shell script about 30+ lines I tend to back up and break out ruby/perl/python/anything but shell. Think of it as a succinct glue language and you'll do fine.

In the meantime feel free to use this python thing, its rather fun to be honest. Just wanted to demonstrate the unix-y way of doing it.

Post reply on HN