Last active
April 20, 2019 14:27
-
-
Save davipatti/22086efd33e04b5a97ca8364d13bc4bd to your computer and use it in GitHub Desktop.
The sort | uniq -c | sort dance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
from itertools import groupby | |
lines = sorted(map(lambda l: l.rstrip(), sys.stdin.readlines())) | |
counts = ((len(list(group)), line) for line, group in groupby(lines)) | |
for count, line in sorted(counts, key=lambda x: x[0]): | |
print("{:7d} {}".format(count, line)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
from collections import defaultdict | |
from operator import itemgetter | |
counts = defaultdict(int) | |
for line in sys.stdin: | |
counts[line] += 1 | |
for line, count in sorted(counts.items(), key=itemgetter(1)): | |
print("{:7d} {}".format(count, line), end="") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Come on! | |
Uggh! | |
Come on, although ya try to discredit | |
Ya still never edit | |
The needle, I'll thread it | |
Radically poetic | |
Standin' with the fury that they had in '66 | |
And like E-Double I'm mad | |
Still knee-deep in the system's shit | |
Hoover, he was a body remover | |
I'll give ya a dose | |
But it'll never come close | |
To the rage built up inside of me | |
Fist in the air, in the land of hypocrisy | |
Movements come and movements go | |
Leaders speak, movements cease | |
When their heads are flown | |
'Cause all these punks | |
Got bullets in their heads | |
Departments of police, the judges, the feds | |
Networks at work, keepin' people calm | |
You know they went after King | |
When he spoke out on Vietnam | |
He turned the power to the have-nots | |
And then came the shot | |
Yeah! | |
Yeah, back in this... | |
Wit' poetry, my mind I flex | |
Flip like Wilson, vocals never lackin' dat finesse | |
Whadda I got to, whadda I got to do to wake ya up | |
To shake ya up, to break the structure up | |
'Cause blood still flows in the gutter | |
I'm like takin' photos | |
Mad boy kicks open the shutter | |
Set the groove | |
Then stick and move like I was Cassius | |
Rep the stutter step | |
Then bomb a left upon the fascists | |
Yea, the several federal men | |
Who pulled schemes on the dream | |
And put it to an end | |
Ya better beware | |
Of retribution with mind war | |
20/20 visions and murals with metaphors | |
Networks at work, keepin' people calm | |
Ya know they murdered X | |
And tried to blame it on Islam | |
He turned the power to the have-nots | |
And then came the shot | |
Uggh! | |
What was the price on his head? | |
What was the price on his head? | |
I think I heard a shot | |
I think I heard a shot | |
I think I heard a shot | |
I think I heard a shot | |
I think I heard a shot | |
I think I heard, I think I heard a shot | |
'He may be a real contender for this position should he | |
abandon his supposed obediance to white liberal doctrine | |
of non-violence...and embrace black nationalism' | |
'Through counter-intelligence it should be possible to | |
pinpoint potential trouble-makers | |
And neutralize them, | |
neutralize them | |
neutralize them | |
Wake up! | |
Wake up! | |
Wake up! | |
Wake up! | |
Wake up! | |
Wake up! | |
Wake up! | |
Wake up! | |
How long? Not long, cause what you reap is what you sow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment