Skip to content

Instantly share code, notes, and snippets.

// modified from
// https://developers.cloudflare.com/workers/examples/read-post/
// https://developers.cloudflare.com/workers/examples/cors-header-proxy/
async function readRequestBody(request, url) {
const { headers, method } = request;
const contentType = headers.get("content-type") || "";
const headersObj = Object.fromEntries(headers);
@fyears
fyears / backup_and_encrypt.sh
Last active September 6, 2020 04:52
note about command line for backing up and encryption at the same time
# see https://askubuntu.com/questions/95920
# and this https://willhaley.com/blog/encrypt-single-file-linux-aes-gpg/
# and that https://github.com/SixArm/gpg-encrypt/blob/master/gpg-encrypt
tar -cz your_dir | gpg \
--no-symkey-cache \
--cipher-algo AES256 \
--digest-algo sha256 \
--cert-digest-algo sha256 \
--compress-algo none -z 0 \
@fyears
fyears / generate.sh
Created November 2, 2014 06:31
pyside+qml+pyinstaller
pyinstaller -F -w --noupx main.spec
@fyears
fyears / note.md
Last active February 6, 2024 09:59
how to install scipy numpy matplotlib ipython in virtualenv

if you are using linux, unix, os x:

pip install -U setuptools
pip install -U pip

pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
@fyears
fyears / install-osx-10.9-mavericks-in-thinkpad-t410.md
Last active July 18, 2022 06:42
install osx 10.9 mavericks in thinkpad t410

本文完全参照 http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1420886 ,两者原理一样,内容大同小异,本文方便没有 osx 系统和初次安装的人。

本文适用范围:thinkpad t410 配有独显的型号,并且机器上原来只有 windows 8.1 (或者 7 或者 8,xp 不知道能否成功)系统,并且硬盘有足够空间,并且硬盘是 mbr 分区的。除非你知道你自己在干什么,以上条件缺一不可。

本文涉及到的帖子为:

请预先下载以下文件:

@fyears
fyears / README.md
Created December 17, 2012 14:48
add pinyin field to the contacts vcard

contacts.vcf 加上拼音字段

首先导出 contacts.vcf。 推荐使用免费工具 iTools,其实这个 gist 就是在它的格式下研究得到的。

格式如同 gist 里面的 contacts.vcf 所示。

注意 QQ 同步助手里面导出的格式很奇怪,与这个 gist 不兼容。

然后你懂的:

@fyears
fyears / soinput.py
Created November 28, 2012 14:46
python stdin example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
usage:
cat about.txt | python soinput.py
'''
import sys