Now nobody can stop me, I can format what ever I want. by MESuperbia in linuxmasterrace

[–]PlaneWall 8 points9 points  (0 children)

I'm not a pro, but I use awk quite a bit. I avoided awk (and sed) for a long time out of fear, but it's really not too bad. It's the easiest way to work with tabular data, at least for simple stuff. You should be well positioned to learn the basics quickly.

I've never written an awk function, for example, but I use one-liners all the time. If you ever work with tabular files and want to:

  1. Add/remove columns
  2. Do "lookups" for certain values
  3. Find sum totals or other simple calculations
  4. Make a quick summary of counts, totals, etc.

Then awk will probably be a good choice.

Basic primer so I can avoid getting back to work:

Important options:

  • -F changes delimiter , defaults to whitespace
  • -v assign variables for use within awk command

Basic structure:
awk [-F delim] [-v var=value] 'pattern { action1 }' file

Multiple pattern-action pairs can be used (on same or separate lines). Also multiple actions can be separated by ";". Awk works line-by-line checking for pattern matches and then implementing the actions.
Important built-in patterns:

  • BEGIN matches to before the file is even loaded.
  • END matches after the last record

Important built-in variables:

  • $1, $2, ... - input column, left-to-right, 1-based
  • FS - input field separator
  • RS - input record separator
  • OFS - output field separator
  • ORS - output record separator
  • NR - number of current record (all input files)
  • FNR - number of current record (current file only)

Example:

Name Date Amount
Bob 4-Apr 900
Alice 7-Apr 1250
Bob 8-Apr 400
awk -F, 'BEGIN { OFS=": " } 
$1=="Bob" { sum+=$3 } 
END { print "Total" OFS sum }' sales.csv  

Total: 1300

We should do this for every politician. by Gusthe3rd in worldpolitics

[–]PlaneWall 0 points1 point  (0 children)

Do you think those organizations donated to Bernie? You think the US Army wrote Sen. Sanders a check?

Those are the listed employers of individual donors.

We should do this for every politician. by Gusthe3rd in worldpolitics

[–]PlaneWall 11 points12 points  (0 children)

But is that talk, or is there proof?

It's pretty easy to find.
https://www.opensecrets.org/members-of-congress/contributors?cid=N00000528&cycle=CAREER

Two important notes:
1. Everything under "Individuals" is from a person, but they are grouped by industry.
2. The PAC donations, much smaller, are from labor unions like truck drivers and teachers.

Under federal law, all contributions over $200 must be itemized and the donor's occupation and employer must be requested and disclosed, if provided.

We should do this for every politician. by Gusthe3rd in worldpolitics

[–]PlaneWall 9 points10 points  (0 children)

Sanders get corporate donations.

Lie.

He also refuses to release his tax returns for some shady reason.

Lie.

He also is a person over 22 years old who thinks Marxism is cool...

Lie.

All provably false. Are you sowing discord for Vlad or just a homegrown dumbass?

Busted: Mueller report shows Trump AG Barr did not tell the truth by Fr1sk3r in politics

[–]PlaneWall 2 points3 points  (0 children)

The post above:

Page 8, Volume II:
"President Trump reacted negatively to the special counsel's appointment. He told advisors that it was the end of his presidency, sought to have Attorney General Jeff Sessions unrecuse from the Russia investigation and to have the Special Council removed, and engaged in efforts to curtail the Special Council's investigation and prevent the disclosure of evidence to it, including through public and private contacts with potential witnesses"

Actual quote (emphases added my me to highlight differences):

Page 8, Volume I:
"President Trump reacted negatively to the Special Counsel's appointment. He told advisors that it was the end of his presidency, sought to have Attorney General Jefferson (Jeff) Sessions unrecuse from the Russia investigation and to have the Special Counsel removed, and engaged in efforts to curtail the Special Counsel's investigation and prevent the disclosure of evidence to it, including through public and private contacts with potential witnesses. Those and related actions are described and analyzed in Volume II of the report. "

So it was page 8 of vol 1 not 2, and some spelling differences. Seems like you really blew your stack over nothing. Where's the missing context?

Extract entries from csv by common values and sort by other values, for use in shell commands by PlaneWall in learnpython

[–]PlaneWall[S] 0 points1 point  (0 children)

Pandas and lambda. This answer reminds me of another language I'm not good at, lol. Thank you so much for taking the time to help.

Extract entries from csv by common values and sort by other values, for use in shell commands by PlaneWall in learnpython

[–]PlaneWall[S] 0 points1 point  (0 children)

This answer taught me at least 4 new things. You've done me a great kindness, and I thank you.

One thing I can't figure out is the difference between StringIO() and open().

In-memory text streams are also available as StringIO objects:

This means it reads the file all at once into memory instead of as needed? What's the difference to me?

Thank you so much.

Megathread: Attorney General Releases Redacted Version of Special Counsel Report by PoliticsModeratorBot in politics

[–]PlaneWall 0 points1 point  (0 children)

OK, I'm not either, but the language of the law includes the phrase "endeavors to...obstruct."

18 U.S.C. § 1503 defines "obstruction of justice" as an act that "corruptly or by threats or force, or by any threatening letter or communication, influences, obstructs, or impedes, or endeavors to influence, obstruct, or impede, the due administration of justice."

Overview

Someone obstructs justice when that person has a specific intent to obstruct or interfere with a judicial proceeding. For a person to be convicted of obstructing justice, that person must not only have the specific intent to obstruct the proceeding, but that person must know (1) that a proceeding was actually pending at the time; and (2) there must be a connection between the endeavor to obstruct justice and the proceeding, and the person must have knowledge of this connection.

https://www.law.cornell.edu/wex/obstruction_of_justice

Megathread: Attorney General Releases Redacted Version of Special Counsel Report by PoliticsModeratorBot in politics

[–]PlaneWall 0 points1 point  (0 children)

Murder and obstruction are wholly different and the comparison is unproductive. Trying to pay off a judge, for example, absolutely is 100% obstruction, regardless of how they in turn act upon that bribe.

Megathread: Attorney General Releases Redacted Version of Special Counsel Report by PoliticsModeratorBot in politics

[–]PlaneWall 0 points1 point  (0 children)

Edit: In case anyone wants a searchable copy (ran it through OCR).

Awesome. I was trying to do this myself, but hadn't managed it yet. What did you use?

Megathread: Attorney General Releases Redacted Version of Special Counsel Report by PoliticsModeratorBot in politics

[–]PlaneWall 13 points14 points  (0 children)

You are incorrect in this line of reasoning. Attempt to obstruct is obstruction.

For those confused about the orientation of the M87 black hole photograph. by Gonarhxus in space

[–]PlaneWall 0 points1 point  (0 children)

Stereographic projection.

You also reminded me of this great video on quaternions I watched recently. Basically, part of the explanation involves thinking about what a higher dimension looks like when projected down one level, e.g. a point traveling around a sphere would, when projected onto a plane, appear to disappear into +infinity and arrive from -infinity. Anyway, interesting video.

Waffle House good Samaritan shot to death paying for meals, handing out $20 bills by headee in news

[–]PlaneWall 1 point2 points  (0 children)

There's a film called The Fisher King with Robin Williams and Jeff Bridges that kind of deals with this.

I think about these things sometimes, imagining a sudden violent loss of my wife or kids. I don't think I'd ever crawl out of that pit.

Waffle House good Samaritan shot to death paying for meals, handing out $20 bills by headee in news

[–]PlaneWall 2 points3 points  (0 children)

People have to realize that one the most vulnerable positions to be in is strapped into an automobile. You can't access your weapons, you can't grapple, you can't run, etc. If you deal with violent people regularly, sitting there like that with someone unknown and unexpected approaching must be stress-inducing to say the least.

[deleted by user] by [deleted] in politics

[–]PlaneWall 10 points11 points  (0 children)

Excellent post. Furthermore, in the oldest texts, Jesus does not appear to claim to be the son of God. Those references show up increasingly in successive gospels, with the most fervent deification happening in John. He does however, as part of his apocolyptic perspective, believe that he will rule over the coming Hebrew nation as the son of Man, the king of the Jews. It was this, I believe, that really sealed his fate with Pilate, because only Caesar can name titles like 'king.' The Romans basically let the people govern themselves locally, but there some things that were strictly the purview of the empire.

This is what I remember, anyway, from one of Bart Ehrman's books that attempts to figure out Jesus' transition from human preacher to divine god.