Skip to content

Instantly share code, notes, and snippets.

View pedroarthur's full-sized avatar

Pedro Arthur Duarte [aka JEdi] pedroarthur

View GitHub Profile
@pedroarthur
pedroarthur / example.py
Created June 12, 2020 01:52
Demonstra getitem/setitem
class Getitem(object):
def __init__(self, a):
self.a = a
def __getitem__(self, attr):
print(f"__getitem__ {attr}")
return getattr(self, attr)
class Setitem(Getitem):
def __setitem__(self, attr, value):
#!/bin/bash
split () { grep -o .; }
remove_spaces () { grep -vP '[[:space:]]+'; }
count () { sort | uniq -c; }
read -r _ # just ignore and halt on EoF
while read -r sentence
do