The experiment
Preparation
truncate -s20G d1.img
truncate -s20G d2.img
truncate -s20G d3.img
truncate -s20G d4.img
set ld1 (sudo losetup --show --find d1.img)
import math | |
import osgeo.gdal as gdal | |
import timeit | |
file_path = "1677269839.tif" | |
ds = gdal.Open(file_path) | |
file_block_size = ds.GetRasterBand(1).GetBlockSize() | |
xoff = 0 |
import argparse | |
from multiprocessing import Pool | |
import btrfs | |
parser = argparse.ArgumentParser() | |
parser.add_argument("btrfs_fs_mountpoint") | |
args = parser.parse_args() | |
def filter_file(path, sieve): | |
with open(path, 'r') as fr: | |
lines = fr.readlines() | |
with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp: | |
temp.writelines(l for l in lines if l.rstrip() not in sieve) | |
temp.flush() | |
os.fsync(temp.fileno()) | |
os.replace(temp.name, path) | |
@>>> timeit.timeit("filter_file('/tmp/t', ['abcnewsvideo 9758031'])", number=100, setup="from __main__ import filter_file") |
Preparation
truncate -s20G d1.img
truncate -s20G d2.img
truncate -s20G d3.img
truncate -s20G d4.img
set ld1 (sudo losetup --show --find d1.img)
Aaron Swartz is the founder of Demand Progress, which launched the campaign against the Internet censorship bills (SOPA/PIPA) and now has over a million members. He is also a Contributing Editor to [The
# Author: Sean Gillies | |
# License: BSD | |
# https://pypi.org/project/de9im/ | |
""" | |
>>> from de9im import pattern | |
>>> side_hug = pattern('FF*F0****') | |
>>> im = p.relate(q) | |
>>> print im | |
FF2F01212 |
# https://old.reddit.com/r/pushshift/comments/ajmcc0/information_and_code_examples_on_how_to_use_the/ | |
with open("filename.zst", 'rb') as fh: | |
dctx = zstd.ZstdDecompressor(max_window_size=2147483648) | |
with dctx.stream_reader(fh) as reader: | |
previous_line = "" | |
while True: | |
chunk = reader.read(2**24) # 16mb chunks | |
if not chunk: | |
break |
import itertools | |
subcommand_abbrevs = [] | |
def consequtive_combos(s): | |
combos=[list(itertools.combinations(s,x)) for x in range(1,len(s))] | |
combos=set([''.join(e) for e in sum(combos,[]) if e[0] == s[0] and ''.join(e) not in subcommand_abbrevs]) | |
subcommand_abbrevs.extend(combos) | |
return combos | |
q=consequtive_combos('merge-online-local') |
def youtube_dl_id(file) -> str: | |
if len(file) < 15: | |
return "" | |
# rename old youtube_dl format to new one: cargo install renamer; fd -tf . -x renamer '\-([\w\-_]{11})\.= [$1].' {} | |
yt_id_regex = re.compile(r"-([\w\-_]{11})\..*$|\[([\w\-_]{11})\]\..*$", flags=re.M) | |
file = str(file).strip() | |
yt_ids = yt_id_regex.findall(file) | |
if not yt_ids: | |
return "" |