Skip to content

Instantly share code, notes, and snippets.

View fffonion's full-sized avatar

Wangchong Zhou fffonion

View GitHub Profile
var canvas = document.getElementsByTagName('canvas')[0];
var context = canvas.getContext('2d');
var runner = new Runner();
var insight = 280;
runner.restart();
var keeper = setInterval(function() {
if (!runner || !runner.onKeyDown) {
clearInterval(keeper);
return;
}
@phith0n
phith0n / php5.dockerfile
Last active May 19, 2021 12:40
分享自己用的两份Alpine-php-fpm的dockerfile
FROM alpine:3.3
MAINTAINER Didiet Noor <dnoor@kulina.id> (@lynxluna)
# Patch APK Mirror to YKode
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.3/main" > /etc/apk/repositories
ENV TIMEZONE Asia/Shanghai
ENV PHP_MEMORY_LIMIT 512M
ENV MAX_UPLOAD 50M
@delicb
delicb / ironpy_aes_crypt.py
Created January 18, 2013 10:36
IronPython AES encrypt and decrypt
# NOTE: Change this to random numbers in range (0, 255) inclusive
_key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
_vector = [0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0]
from System import Array, Byte
from System.Text import UTF8Encoding
from System.IO import MemoryStream
import re, sys
from xml.dom import minidom, Node
import math
import argparse
class Matrix:
def m(self, i, j, value=None):
if i >= self.rows or j >= self.cols:
raise ValueError("Argument out of range")
@wintercn
wintercn / HTMLLexicalParser.js
Last active August 5, 2019 11:16
HTML语法分析器模型
function StartTagToken(){
}
function EndTagToken(){
}
function Attribute(){
}
@mrluanma
mrluanma / cryptography_3des_demo.py
Last active July 23, 2019 06:09
Python 用 PyCrypto, M2Crypto, ncrypt, cryptography 3DES ECB mode 加密解密 demo。
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.backends import default_backend
backend = default_backend()
key = os.urandom(16)
text = b'Hello, there!'
padder = padding.PKCS7(algorithms.TripleDES.block_size).padder()
@randphu
randphu / extract_buka.py
Last active November 13, 2018 12:32
extract buka manga archive (*.buka)
#!/usr/bin/env python3
'''
Layout of buka manga archives
Whole archive
| b"buka" | unknown (16 bytes) | manga title (c string) | entry table | file 1 | file 2 | ...
Entry table
| table size (uint32) | entry 1 | entry 2 | ... |