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
import re | |
def get_extension(filename): | |
regex = re.compile(r'^.*?.(?P<ext>.tar\.gz|.tar\.bz2|.\w+)$') | |
return regex.match(filename).group('ext') |
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
import re | |
def get_extension(filename): | |
regex = re.compile(r'^.*?[.](?P<ext>tar\.gz|tar\.bz2|\w+)$') | |
return regex.match(filename).group('ext') |
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
git conflicts |
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
diff --name-only --diff-filter=U |
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
git config --global alias.conflicts "diff --name-only --diff-filter=U" |
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
beep() { | |
$@ && afplay /System/Library/Sounds/Glass.aiff || afplay /System/Library/Sounds/Blow.aiff | |
} |
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
beep() { | |
$@ && paplay /usr/share/sounds/gnome/default/alerts/glass.ogg || paplay /usr/share/sounds/alsa/Noise.wav | |
} |
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
from collections import OrderedDict | |
list(OrderedDict.fromkeys(xs)) |
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
# Let's create a list with duplicated elements: | |
ls = [1,1,1,2,2,1,5,4,3,2,1] | |
# And let's now remove them in just one line: | |
l2 = list(set(ls)) | |
# See the result: |
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
[matias@MacBookPro]:~$ python | |
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) | |
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def f(): | |
... print 'f()' | |
... | |
>>> def g(): | |
... print 'g()' | |
... |