This file contains 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 string import ascii_letters | |
from itertools import cycle | |
import random | |
from copy import deepcopy | |
from functools import reduce | |
import numpy as np | |
from functools import partial | |
import timeit | |
import matplotlib.pyplot as plt | |
import pandas as pd |
This file contains 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 | |
from functools import partial | |
import timeit | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
from itertools import starmap, count | |
from string import digits | |
from random import choices |
This file contains 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
sum(num % i == 0 for i in range(1, int(sqrt(num)) + 1)) | |
# Equivalent to: | |
sum_ = 0 | |
for i in range(1, int(sqrt(num)) + 1): | |
if num % i == 0: | |
sum_ += 1 | |
# Inner expression: |
This file has been truncated, but you can view the full file.
This file contains 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
100000 100000 | |
1 31789 82245 | |
0 48604 88346 | |
1 16301 94014 | |
1 67473 79175 | |
1 5046 68407 | |
1 15554 31743 | |
0 27007 58353 | |
1 8603 83722 | |
1 5326 70222 |
This file contains 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 ROOT | |
class TChain(ROOT.TChain): | |
""" | |
A contextmanager for TChain, which loads from a file directly. | |
Can disable all branches except the needed branches (default: all enabled). | |
""" | |
def __init__(self, tree_name, file_names=None, active_branches=None): | |
super(TChain, self).__init__(tree_name) |
This file contains 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 ROOT | |
import contextlib2 | |
class TTree: | |
""" | |
A contextmanager for TTree, which loads from a file directly. | |
Can disable all branches except the needed branches (default: all enabled). | |
""" | |
def __init__(self, tree_name, file_name, active_branches=None): |
This file contains 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
"""SMTP user checker. | |
Usage: | |
argparser_comp.py SERVER USERNAMES [(-p <p>| --port=<p>)] | |
argparser_comp.py (-h | --help) | |
Options: | |
-h --help Show this screen. | |
-p <p> --port=<p> SMTP port of server [default: 25]. |