Skip to content

Instantly share code, notes, and snippets.

View slanterns's full-sized avatar
💭
忽忽若有所亡

Slanterns slanterns

💭
忽忽若有所亡
View GitHub Profile
@squaresmile
squaresmile / DumpAZW6_py3.py
Created April 21, 2020 00:57
Dump images in Kindle's AZW6 (.azw.res) file (Python3 version of this script: https://www.mobileread.com/forums/showpost.php?p=3114050&postcount=1145)
import argparse
import imghdr
import os
import struct
def get_image_type(imgname, imgdata=None):
imgtype = imghdr.what(imgname, imgdata)
# horrible hack since imghdr detects jxr/wdp as tiffs
#!/bin/bash
# for: bulk merge bilibili UWP download file *.flv
# by: blog.502.li
# date: 2019-01-12
# 将该脚放到 UWP 客户端下载缓存主目录下执行,安装 ffmpeg、jq
set -xu
download_dir=$(pwd)
mp4_dir=${download_dir}/mp4
mkdir -p ${mp4_dir}
@tduarte
tduarte / publish-ghpages.md
Last active May 8, 2025 12:36
If you need to force push an subtree
git checkout master # you can avoid this line if you are in master...
git subtree split --prefix dist -b gh-pages # create a local gh-pages branch containing the splitted output folder
git push -f origin gh-pages:gh-pages # force the push of the gh-pages branch to the remote gh-pages branch at origin
git branch -D gh-pages # delete the local gh-pages because you will need it: ref
@tianyuf
tianyuf / baidu-as-a-network-utility.css
Created May 14, 2016 15:03
BaaN: Baidu as a Network Utility - 百度的实用主义方法论.
@-moz-document domain("baidu.com") {
body {
display: none;
}
html {
margin: 30px;
}
html::after {
var dc = new DataCollection();
dc.add("ID", "45115");
Server.sendRequest("SupportOppose.voteOppose", dc, function(res) { console.log(res); });
@CMCDragonkai
CMCDragonkai / higher_kinded_types_in_rust_and_haskell.md
Last active September 8, 2024 17:06
Rust/Haskell: Higher-Kinded Types (HKT)

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
@cnDelbert
cnDelbert / How to install tcpping on Linux.md
Last active December 23, 2024 21:15
How to install tcpping on Linux

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@msrose
msrose / combining-git-repositories.md
Last active January 16, 2025 09:26
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@yefuchs
yefuchs / gfw_contributors.md
Last active April 11, 2025 14:50
GFW Contributers

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

@idealhack
idealhack / 2009.md
Last active June 10, 2024 16:33
2009匿名网民宣言

你好,中国政府网络审查部门。我们是匿名网民。长久以来,我们目视了你对互联网的所作所为。你对互联网言论自由的无端封锁,你对互联网先进技术的敌视,你勾结宣传喉舌对事实真相的扭曲,你运用网络评论员对网络舆论的的毒化,这些都深深地刻印在我们的记忆中。随着最近你绿坝强制安装的通知和对谷歌的恶毒诽谤的出炉,你全面控制全面审查互联网的险恶用心已经明白无误地展现在人们面前。我们匿名网民于此决定,我们将从2009年7月1日开始在全球范围内对你所控制的网络审查体系发起全面袭击。

为了保卫互联网的自由,为了推动人类网络化的前进,同时也为了我们自己的网络权利,我们将对你的网络审查体系进行系统性破坏并展现你所谓网络审查体系在真正网络力量之前的渺小。我们将你视为网络头号公敌。我们对你发起的将是持久战。无论你如何利用宣传喉舌愚弄舆论,你终将湮没在人民战争的汪洋大海之中。你古板的宣传手段,你文革般陈旧口号式的叫嚣,你对互联网的无知,你“为了下一代”之类的虚伪说辞,这些都为你的彻底失败敲响了丧钟。你无处可逃,因为我们无处不在。国家暴力机器不能拯救你,因为我们每一个成员的倒下,都意味着另外十名新成员的加入。我们清楚地意识到你会运用你惯常的阶级斗争伎俩,在你的蛊惑宣传中赋予我们“不明真相群众”的标签在我们与普通民众之间划出界线,然后赋予我们“少数不法分子”的标签在我们内部划出界线,最终各个击破。对我们来说,这是可以接受的。事实上,这是我们所鼓励的。原因很简单,你越这样看待你的人民,你皇帝新装的美丽就越不言自喻。

随着人类网络文明的发展,处于优势地位的统治阶级敌视网络化的陈旧意识形态逐渐成为历史发展进步的阻碍。旧意识形态势力对新兴网络势力的诬蔑和压迫,对网络世界的敌视和封锁,这些都表明了他们对于历史潮流的恐惧,都将成为他们在退出历史舞台之前的最后挣扎。那些妄图在历史车轮面前螳臂挡车的,都将最终被扫进历史的垃圾堆。即使你的血液正在得到数字移民的缓慢补充,你在可见的未来将仍然无法理解网络。我们会欣赏你对于异己几十年不变的阴谋论观点和文革口号文风,因为我们也会有怀旧的心情;我们也将笑谈你试图在互联网上划出国界的举动,因为愚蠢行为从来都是史书中的笑点。不过我们可以真诚地告诉你:

没有人想要更迭你的政权,我们对你陈旧的政权概念和意识形态烂腌菜毫不感兴趣。你无法理解在人类网络化的历史潮流之前宏大叙事为何而消解,你也无法理解国家和民族概念为何将分崩离析,你无法