Skip to content

Instantly share code, notes, and snippets.

View bytemain's full-sized avatar

Jiacheng bytemain

View GitHub Profile
@shakna-israel
shakna-israel / Prose.md
Last active January 6, 2025 17:00
Obfuscating Python

Obfuscating Python

Obfuscation isn't difficult in most programming languages. It's why we have "good practices" because it is so easy to hide what you mean in badly written code.

Obfuscation tends to be even easier in dynamic languages because of how forgiving they tend to be - and because they tend to give you direct access to the environment so that you can manipulate it.

Today, for fun, I'm going to obfuscate this code:

def _(n):

if n <= 0:

@ThaddeusJiang
ThaddeusJiang / interview report template (tech)
Last active August 28, 2024 14:42
Interview report template (tech)
Total: 1~5
下面各项得分的平均分
Experience: 1~5
过往项目的客户群(ToB or ToC)、项目规模、项目中担当的角色、是否有突出贡献等等
Skill: 1~5
开发基础、设计能力、能否攻克中大型开发难题,能否担当 full stack 任务等等
@Venryx
Venryx / WebpackConfig.js
Created September 8, 2019 03:10
Example inline-plugin to replace CopyWebpackPlugin
[...]
let fs = require("fs-extra");
webpackConfig.plugins.push({
apply(compiler) {
console.log(`Valid hook names: ${Object.keys(compiler.hooks)}`);
//compiler.hooks.beforeRun.tap("CopyPlugin_Custom", params=>{
compiler.hooks.shouldEmit.tap("CopyPlugin_Custom", params=>{
console.log(`Copying some difficult files (eg. *.wasm) from "node_modules/..." to "Resources/FromNodeModules/...".`);
@hutusi
hutusi / git paging.md
Last active January 1, 2024 15:56
Git checkout next / prev commit

Treat git log as a book, exec git next or git prev to checkout the next or the previous commit.

Please check hutusi/git-paging for updates.

@dinhchi27
dinhchi27 / Key Sublime Text 3.2.1 Build 3207 - Sublime Text 3 License Key
Last active August 25, 2025 03:14
Key Sublime Text 3.2.1 Build 3207 - Sublime Text 3 License Key
Key Sublime Text 3.2.1 Build 3207
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
@tohagan
tohagan / traverse.ts
Last active February 29, 2024 06:09
Typescript function to visit all nodes in a JS object. Visitor pattern
export type TraversePath = Array<string|number> | undefined;
export type TraverseVisitor = (parent: any, key: string | number, val: any, path: TraversePath) => void;
export function traverse(obj: any, visit: TraverseVisitor, path: TraversePath) {
function perNode(key: string | number, val: any) {
const path1 = path ? path.concat([key]) : undefined;
visit(obj, key, val, path1);
traverse(val, visit, path1);
}
@gatopeich
gatopeich / dataclass_from_dict.py
Created February 19, 2019 15:08
Python 3.7 dataclass to/from dict/json
from dataclasses import dataclass, fields as datafields
from ujson import dumps, loads
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json
@dataclass
class Point:
x: float
y: float
# Shallow dataclass can be rebuilt from dict/json:
@wwwjfy
wwwjfy / cte.py
Created January 27, 2019 16:14
GINO equivalence of SQLAlchemy CTE
import asyncio
from gino import Gino
from sqlalchemy import Column
db = Gino()
class Node(db.Model):
__tablename__ = 'node'
id = Column(db.Integer, primary_key=True)
@irazasyed
irazasyed / 1-dnsmasq-dnscrypt-proxy-setup.md
Last active June 24, 2025 20:17
How to Setup dnsmasq with dnscrypt-proxy and Cloudflare DNS on macOS

How to Setup dnsmasq with dnscrypt-proxy and Cloudflare DNS on macOS

Using Laravel Valet for localhost development, So it installs dnsmasq with it. dnsmasq runs on port 53, The default DNS port. So we setup dnscrypt-proxy on port 5300 with the default config files in this gist.

dnscrypt-proxy Installation

brew install dnscrypt-proxy