Skip to content

Instantly share code, notes, and snippets.

Avatar

Jianfeng Zhang swordfeng

  • Redwood City, California
View GitHub Profile
@swordfeng
swordfeng / 歪比吧卜.user.js
Last active Jun 30, 2021
比比比比吧歪比歪比比卜比歪比歪比比吧吧歪歪卜比比吧比吧歪歪吧吧吧卜比比歪比吧歪比比比歪卜比比歪比吧比吧比歪比卜比歪歪吧比比吧吧吧歪卜比歪歪吧歪吧比比歪比卜比歪比吧吧吧吧歪吧比卜比歪歪比比吧比比歪吧卜
View 歪比吧卜.user.js
// ==UserScript==
// @name 歪比吧卜
// @namespace https://taiho.moe/
// @version 0.1.6
// @description 比比比比吧歪比歪比比卜比歪比歪比比吧吧歪歪卜比比吧比吧歪歪吧吧吧卜比比歪比吧歪比比比歪卜比比歪比吧比吧比歪比卜比歪歪吧比比吧吧吧歪卜比歪歪吧歪吧比比歪比卜比歪比吧吧吧吧歪吧比卜比歪歪比比吧比比歪吧卜
// @author swordfeng
// @match http://bgm.tv/group/*
// @match https://bgm.tv/group/*
// @match http://bangumi.tv/group/*
// @match https://bangumi.tv/group/*
@swordfeng
swordfeng / ssp.py
Last active Feb 28, 2019
load stored SSH passwords
View ssp.py
#!/usr/bin/env python3
import sys
import os
import re
from pathlib import Path
def main():
args = list(sys.argv)[1:]
password = None
@swordfeng
swordfeng / chatstat.js
Created Nov 5, 2018
Count number of messages for each person
View chatstat.js
const fs = require('fs');
const cheerio = require('cheerio');
require('console.table');
const count = {};
for (let f of fs.readdirSync('.')) {
if (f.endsWith('.html')) {
let content = fs.readFileSync(f);
countContent(content);
View ssf.js
// reference: https://github.com/KDE/kimtoy/blob/master/kssf.cpp
const crypto = require('crypto');
const zlib = require('zlib');
const fs = require('fs');
let aes = crypto.createDecipheriv('aes-256-cbc', Buffer.from([
0x52,0x36,0x46,0x1A,0xD3,0x85,0x03,0x66,
0x90,0x45,0x16,0x28,0x79,0x03,0x36,0x23,
0xDD,0xBE,0x6F,0x03,0xFF,0x04,0xE3,0xCA,
View random-string.js
#!/usr/bin/node
var targetEntropy = parseFloat(process.argv[2]);
var charSet = process.argv[3] && process.argv[3].toLowerCase();
var testStrength = parseInt(process.argv[4]) || 16384;
var filter = () => true;
switch (charSet) {
case 'alphanum': filter = isAlphaNum; break;
}
@swordfeng
swordfeng / weechat-swutil.py
Created Feb 16, 2017
swordfeng's script for weechat
View weechat-swutil.py
# Copyright (c) 2014 /cyb/
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
@swordfeng
swordfeng / basecourvalue.js
Created Jun 2, 2016
A 'Chinese Specific Socialism Core Value' (or somehow a name like that) -based binary encoder.
View basecourvalue.js
var zlib = require('zlib');
var values = ['富强', '民主', '文明', '和谐', '自由', '平等', '公正', '法治', '爱国', '敬业', '诚信', '友善'];
var nums = {};
for (var i = 0; i < 12; i++) nums[values[i]] = i;
var primes = [2, 3, 5, 7, 11, 13, 17, 19];
function encode(str) {
var buf = Buffer(str, 'utf8');
if (buf.length === 0) return '';
var results = [];
View keybase.md

Keybase proof

I hereby claim:

  • I am swordfeng on github.
  • I am swordfeng (https://keybase.io/swordfeng) on keybase.
  • I have a public key ASDMNVMmhk9tefRYuLMqwVnMVTeixGZqgzMo4Mo7xwwovQo

To claim this, I am signing this object:

@swordfeng
swordfeng / openpgp.txt
Created Dec 4, 2015
OpenKeychain API Tests
View openpgp.txt
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:5a11feddf991b901b98ff2c3732afca703d1198a]
@swordfeng
swordfeng / chn_fonts.reg
Last active Jan 19, 2023
Chinese font settings in wine
View chn_fonts.reg
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"
"Arial CE,238"="wqy-microhei.ttc"
"Arial CYR,204"="wqy-microhei.ttc"
"Arial Greek,161"="wqy-microhei.ttc"
"Arial TUR,162"="wqy-microhei.ttc"
"Courier New"="wqy-microhei.ttc"