Skip to content

Instantly share code, notes, and snippets.

View knight42's full-sized avatar
❤️
Loving @FogDong

Jian Zeng knight42

❤️
Loving @FogDong
View GitHub Profile
@knight42
knight42 / beautiful_idiomatic_python.md
Created June 7, 2017 08:55 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@knight42
knight42 / mozlz4a.py
Created January 26, 2018 09:41 — forked from Tblue/mozlz4a.py
MozLz4a compression/decompression utility
#!/usr/bin/env python
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and
# uncompressed file size [4 bytes, little endian]).
#
# This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4
#
@knight42
knight42 / main.go
Created August 13, 2018 17:59 — forked from walm/main.go
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@knight42
knight42 / ci-check-pr-title-format.py
Created April 24, 2023 08:55 — forked from rexwangcc/ci-check-pr-title-format.py
A Python Script for checking Pull Request title conventions.
import sys
import re
from typing import Callable, List
VALID_PR_TAGS = {
# this pr implements new features
"Feature",
# this pr fixes bugs
"Bugfix",
# this pr updates documentation