News for hackers. Stuff that matters.
Re:Notes from MPUG: "Python one-liners" talk by msluyter on Monday June 03, 2013 @01:24PM (#5814516)
A nice list. I use things like the simple web server all the time, and I was unaware of the SMTP server, but some of these seem superflous, like:

   python -m calendar
When you could just do

   cal 2013
(with fewer keystrokes). Is there some advantage to using the python version of the above?
Re:Notes from MPUG: "Python one-liners" talk by smortaz on Monday June 03, 2013 @01:58PM (#5814712)
'cal' is not recognized as an internal or external command, operable program or batch file :).
Re:Notes from MPUG: "Python one-liners" talk by aleyan on Monday June 03, 2013 @04:50PM (#5815923)
Doesn't quite work as expected. From "python -m calendar 1752 9" I get:

     September 1752
  Mo Tu We Th Fr Sa Su
               1  2  3
   4  5  6  7  8  9 10
  11 12 13 14 15 16 17
  18 19 20 21 22 23 24
  25 26 27 28 29 30
"cal 9 1752" on the other hand gives:

      September 1752
   S  M Tu  W Th  F  S
         1  2 14 15 16
  17 18 19 20 21 22 23
  24 25 26 27 28 29 30
Maybe python doesn't auto recognize the timezone?

EDIT: Actually this is pretty bad because python gets all the days of the week before September 1752 in North America wrong.

Re:Notes from MPUG: "Python one-liners" talk by msluyter on Monday June 03, 2013 @05:32PM (#5816166)
Interesting calendar trivia. The Gregorian calendar was adopted in Sept. 1752:

Britain and the British Empire (including the eastern part of what is now the United States) adopted the Gregorian calendar in 1752, by which time it was necessary to correct by 11 days. Wednesday, 2 September 1752 was followed by Thursday, 14 September 1752.

So, in this case, it looks like cal is doing the right thing.

Re:Notes from MPUG: "Python one-liners" talk by dragonwriter on Monday June 03, 2013 @06:09PM (#5816389)
The python version is using proleptic Gregorian and the cal version is using the historical calendar rules for a particular locale. Which is "right" depends on what you want.
Re:Notes from MPUG: "Python one-liners" talk by densh on Monday June 03, 2013 @02:47PM (#5815023)
I liked SimpleHTTPServer so much that I've implemented equivalent of it in Go:

https://bitbucket.org/densh/static-go

Re:Notes from MPUG: "Python one-liners" talk by ssorc on Monday June 03, 2013 @06:45PM (#5816574)
cal works on most Unix systems, but is not part of Windows (is there a Powershell equivalent?) If you don't have cygwin (or similar) installed, these types of one-liners have saved me a number of times for quick hacks on Windows systems.
Re:Notes from MPUG: "Python one-liners" talk by arocks on Monday June 03, 2013 @12:53PM (#5814305)
A lot more examples are in the Python wiki: http://wiki.python.org/moin/Powerful%20Python%20One-Liners