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 json, re | |
f = open('random_json_file') | |
d = f.read() | |
import time | |
starttime = time.time() | |
while True: | |
try: | |
e = json.loads(d) |
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
try: | |
# Get Compressed folder information | |
read_compressed_folder(request.FILES['compressed_folder'].temporary_file_path()) | |
except Exception: | |
# When storing in memory | |
if not os.path.exists(os.path.join(tempfile.gettempdir(), 'temp_compressed_folder')): | |
os.makedirs(os.path.join(tempfile.gettempdir(), 'temp_compressed_folder')) | |
zip_file = zipfile.ZipFile(request.FILES['compressed_folder']) | |
zf = zipfile.ZipFile(os.path.join(tempfile.gettempdir(), 'zipfile_write.zip'), mode='w') |
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
"""Simple Crawler which outputs sitemap.""" | |
import re | |
import sys | |
from urllib.parse import urlparse | |
import requests | |
class Crawler: |
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 math | |
def merge_sort(data, p: int, q: int): | |
# If something goes wrong | |
if q < p : | |
return data | |
# Base case | |
if q - p == 1: | |
if data[q] < data[p]: | |
return data[:p] + [data[q], data[p]] + data[q+1:] |
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
#! python3 | |
from io import BytesIO | |
import struct | |
import socket | |
from enum import auto, Enum | |
from contextlib import closing | |
class PGEntities(Enum): | |
AuthenticationOk = auto() |