Skip to content

Instantly share code, notes, and snippets.

🤖
<unk> <unk> <unk>

Zecong Hu huzecong

🤖
<unk> <unk> <unk>
Block or report user

Report or block huzecong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huzecong
huzecong / remove_pdf_text.py
Created Jan 29, 2020
A snippet to remove the watermark from a certain PDF book. You'll still need to manually locate the watermark element though.
View remove_pdf_text.py
import os
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.filters import FlateDecode
DIR = "path/to/pdf/file"
def main():
pdf = PdfFileReader(os.path.join(DIR, "pfpl.pdf"))
@huzecong
huzecong / guess_colloquium.py
Created Jan 29, 2020
A snippet to guess the shoutkey for LTI colloquiums
View guess_colloquium.py
import itertools
from typing import List, Optional
import requests
def get_url(url_base: str, xs: List[int]) -> str:
return url_base + "".join(chr(x + 97) for x in xs)
@huzecong
huzecong / options.py
Last active Jan 16, 2020
A super-enhanced version of namedtuple that supports multiple inheritance and arbitrary field orders.
View options.py
import collections
import typing
__all__ = [
"Options",
]
class OptionsMeta(typing.NamedTupleMeta):
def __new__(mcs, typename, bases, namespace):
You can’t perform that action at this time.