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
pip list -o --exclude-editable --format freeze | cut -d= -f1 | xargs -n1 pip install -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
from timeit import * | |
try_method = ''' | |
try: | |
d[1][2] | |
except KeyError: | |
pass | |
''' | |
get_method = 'd.get(1, {}).get(2, {})' | |
if_method = ''' |
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 timeit import timeit | |
name = 'common_case' | |
def f0(name): # 0.38833552993028425 | |
stripped_name = name.strip('_') | |
tail = stripped_name[1:] | |
return stripped_name[:1].islower() and tail.lower() != tail | |
def f1(name): # 0.5023811628120246 |
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
"""Download WorldScienceYou coarse videos. | |
Requirements: | |
* python 3.6+ | |
* pip install youtube-dl requests | |
* create a config.py file with USERNAME and PASSWORD variables. | |
Running the script: | |
Make sure the coarse number at the last line of the script is correct and | |
then run... |
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 jdatetime import date as jd, GregorianToJalali, JalaliToGregorian | |
import khayyam, jdatetime | |
from khayyam import JalaliDate | |
from datetime import date | |
from timeit import timeit | |
print('khayyam.__version__:', khayyam.__version__) | |
print('jdatetime.__VERSION__:', jdatetime.__VERSION__) | |
print('Jalali to Gregorian:') |
NewerOlder