Skip to content

Instantly share code, notes, and snippets.

View copyrighthero's full-sized avatar

ZHS copyrighthero

View GitHub Profile
@copyrighthero
copyrighthero / Makefile
Created June 4, 2021 21:38
Generic makefile for running npm commands
ARGS = build clean pack start test
MAKECMDGOALS ?= clean
$(ARGS):
npm run $(MAKECMDGOALS)
.PHONY: $(ARGS)
# 依赖pycrypto库
import binascii
import struct
import base64
import json
import os
from Crypto.Cipher import AES
def dump(file_path):
core_key = binascii.a2b_hex("687A4852416D736F356B496E62617857")
meta_key = binascii.a2b_hex("2331346C6A6B5F215C5D2630553C2728")
@copyrighthero
copyrighthero / UMD.js
Created October 9, 2018 07:41
UMD JavaScript
void function (global, factory) {
'use strict';
// module identifier
var identifier = 'identifier';
// module exportation
if (typeof define === 'function' && define.amd) {
// AMD module
define([], factory);
@copyrighthero
copyrighthero / UMD.js
Created October 9, 2018 07:39
UMD ECMAScript
((global, factory) => {
'use strict';
// module identifier
const identifier = 'identifier';
// module exportation
if (typeof define === 'function' && define.amd) {
// AMD module
define([], factory);
@copyrighthero
copyrighthero / build-tmux.sh
Created April 25, 2017 20:43 — forked from philipsoutham/build-tmux.sh
Build static tmux
#!/usr/bin/env bash
pushd $(dirname $0) > /dev/null; CURRABSPATH=$(readlink -nf "$(pwd)"); popd > /dev/null; # Get the directory in which the script resides
set -x
MUSLPKG="musl:musl.tgz:http://www.musl-libc.org/releases/musl-1.1.4.tar.gz"
LEVTPKG="libevent:libevent2.tgz:https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz"
TMUXPKG="tmux:tmux.tgz:http://iweb.dl.sourceforge.net/project/tmux/tmux/tmux-1.9/tmux-1.9a.tar.gz"
NCRSPKG="ncurses:ncurses.tgz:http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz"
TEMPDIR="$CURRABSPATH/tmp"
TMPLIB="tempinstall/lib"
TMPINC="tempinstall/include"
# Exceptions
# Throw some errors with one line of lambda
# using the generator objects' throw method
_ERROR = lambda _ = "": (_ for _ in ()).throw(AssertionError("Some Error Occured" + _.__str__()))
_ERROR = lambda _ = "": (lambda:(yield _))().throw(AssertionError("Some Error Occured" + _.__str__()))
# So that you can do this
a = b if c else _ERROR()