Skip to content

Instantly share code, notes, and snippets.

@chen3feng
chen3feng / merge_mp3.py
Created February 8, 2024 08:01
Merge MP3 files in archive packages
#!/usr/bin/env python3
import glob
import os
import shutil
import subprocess
import sys
import rarfile
@chen3feng
chen3feng / named_struct.py
Last active December 10, 2020 04:49
NamedStruct, a combinationof struct and namedtuple in python, make code more readable
"""
NamedStruct, a combinationof struct and namedtuple in python, make code more readable.
You can access the fields by name rather than index.
"""
from __future__ import print_function
import struct
from collections import namedtuple
@chen3feng
chen3feng / copy_file_in_zip.py
Last active May 30, 2020 10:40
Copy files inside a zip into another zip file without uncompress it ahead, improve the speed,
#!/usr/bin/env python
"""
Copy files inside a zip into another zip file without uncompress it ahead, improve the speed,
"""
import zipfile
def zipfile_get_entry(source, name):
#!/usr/bin/env python
import os
import sys
import re
import heapq
import subprocess
TOP_N=100
MIN_ALLOC_BYTE=10*1024