Skip to content

Instantly share code, notes, and snippets.

View swordfeng's full-sized avatar

Jianfeng Zhang swordfeng

  • Redwood City, California
View GitHub Profile
@swordfeng
swordfeng / simple.yaml
Last active November 11, 2023 09:44
Prompt config with OMP
version: 2
blocks:
- type: prompt
alignment: left
segments:
- type: text
template: "["
foreground: white
- type: text
template: "{{ .UserName }}"
@swordfeng
swordfeng / 歪比吧卜.user.js
Last active June 30, 2021 16:23
比比比比吧歪比歪比比卜比歪比歪比比吧吧歪歪卜比比吧比吧歪歪吧吧吧卜比比歪比吧歪比比比歪卜比比歪比吧比吧比歪比卜比歪歪吧比比吧吧吧歪卜比歪歪吧歪吧比比歪比卜比歪比吧吧吧吧歪吧比卜比歪歪比比吧比比歪吧卜
// ==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 February 28, 2019 06:28
load stored SSH passwords
#!/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 November 5, 2018 08:04
Count number of messages for each person
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);
// 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,
#!/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 February 16, 2017 07:54
swordfeng's script for weechat
# 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 June 2, 2016 12:22
A 'Chinese Specific Socialism Core Value' (or somehow a name like that) -based binary encoder.
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 = [];

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 December 4, 2015 11:38
OpenKeychain API Tests
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]