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 bash | |
set -e -x | |
if [ "$1" == "" ] || [ "$2" == "" ]; then | |
echo "Usage:" | |
echo "$0 <input directory> <output directory>" | |
exit | |
fi | |
for video in `ls $1`; do |
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
if not sys.version_info > (2, 7): | |
# berate your user for running a 10 year | |
# python version | |
elif not sys.version_info >= (3, 5): | |
# Kindly tell your user (s)he needs to upgrade | |
# because you're using 3.5 features |
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
mylist = [i for i in range(10)] | |
print(mylist) | |
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
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
squares = [x**2 for x in range(10)] | |
print(squares) | |
# [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] |
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
def some_function(a): | |
return (a + 5) / 2 | |
my_formula = [some_function(i) for i in range(10)] | |
print(my_formula) | |
# [2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0] |
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
filtered = [i for i in range(20) if i%2==0] | |
print(filtered) | |
# [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] |
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 sys | |
mylist = range(0, 10000) | |
print(sys.getsizeof(mylist)) | |
# 48 |
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 sys | |
myreallist = [x for x in range(0, 10000)] | |
print(sys.getsizeof(myreallist)) | |
# 87632 |
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
a = 1 | |
b = 2 | |
a, b = b, a | |
print (a) | |
# 2 | |
print (b) | |
# 1 |
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
def get_user(id): | |
# fetch user from database | |
# .... | |
return name, birthdate | |
name, birthdate = get_user(4) |