View salesforce_stream_test.py
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
#!/Users/ant/temp/.venv/bin/python3 | |
import io | |
import csv | |
import random | |
import string | |
import requests | |
import responses | |
import tracemalloc |
View pty_spawn.py
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 | |
import os | |
import sys | |
import pty | |
def waitstatus_to_exitcode(status): | |
""" | |
https://github.com/python/cpython/blob/e0bc8ee945af96f9395659bbe3cc30b082e7a361/Modules/posixmodule.c#L14658-L14748 |
View iter_lines.py
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
def iter_lines(gen): | |
buffer = "" | |
for chunk in gen: | |
buffer += chunk | |
while True: | |
pos = buffer.find('\n') | |
if pos <= -1: | |
break | |
yield buffer[:pos+1] | |
buffer = buffer[pos+1:] |
View python_not_free_mem.py
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/python3 | |
import os | |
import uuid | |
import psutil | |
RELEASE_MEMORY = True | |
def get_rss_memory(): | |
p = psutil.Process(pid=os.getpid()) |
View walk_chdir.py
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/local/bin/python3 | |
import os | |
import logging | |
logger = logging.getLogger(__name__) | |
def commonpath(d1, d2): | |
" returns the length of longest common leading component " |
View mongolock.py
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 os | |
import time | |
import logging | |
from datetime import datetime | |
import pymongo | |
from mongoengine.connection import DEFAULT_CONNECTION_NAME, get_db | |
logger = logging.getLogger(os.path.basename(__file__)) |
View atomic_get_or_create.py
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 mongoengine import Document, IntField, StringField, connect | |
connect('test') | |
class ChatUser(Document): | |
_access = IntField() # internal access counter | |
chat_id = IntField(required=True, unique=True) |
View counts.py
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
def counts(nums, maxes): | |
_nums = sorted(nums) | |
_maxes = sorted(maxes) | |
count = 0 | |
res = {} | |
n = None | |
m = None |
View walk_traversal_problem.py
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/python3 | |
""" | |
os.walk traversal problem | |
""" | |
import os | |
import sys | |
import logging |
View earliest_date.py
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/python3 | |
import sys | |
import itertools | |
from datetime import datetime | |
def main(s): | |
" find earliest possible legal date or raise ValueError " |
NewerOlder