Skip to content

Instantly share code, notes, and snippets.

View bruceCzK's full-sized avatar

Bruce bruceCzK

View GitHub Profile
@bruceCzK
bruceCzK / .tmux.conf.local
Last active July 4, 2023 18:34
tmux conf
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- session creation ----------------------------------------------------------
# prompt for session name when creating a new session, possible values are:
@bruceCzK
bruceCzK / rule.txt
Last active October 1, 2022 15:34
ad-block-rule.txt
[Adblock Plus 2.0]
bilibili.com##.bili-grid:has([data-loc-id="34"])
bilibili.com##.bili-grid:has(.battle-area)
This file is used to be tracked and identified by https://lrc-maker.github.io
@bruceCzK
bruceCzK / waka
Created October 27, 2019 05:26
???
aaa
@bruceCzK
bruceCzK / decode.js
Last active June 8, 2019 13:40
CK2 Decoder of special escape
module.exports = function decodeString(string, encoding, game) {
// string has to be utf8
let content = ''
for (let i = 0; i < string.length; i++) {
const char = string[i].codePointAt(0)
if (char >= 0x10 && char <= 0x13) {
// with leading control character
let high = string[i + 2].codePointAt(0) // high byte
let low = string[i + 1].codePointAt(0) // low byte
@bruceCzK
bruceCzK / compile.js
Last active February 8, 2019 14:57
Generate txt
const {set, get, chain, trim, last, unset} = require('lodash')
module.exports = function generateTxt(json, strings = []) {
for (const item of strings) {
const {original, translation, stage, key} = item
const text = `"${stage > 0 || translation ? translation : original}<!-${original}-!>`
.replace(/^""(.+)/g, '"$1')
.replace(/(.+)""$/g, '$1"')
let keyPath = key.split('|')
@bruceCzK
bruceCzK / parse-pdx-txt.js
Last active October 11, 2022 11:15
CK2TxtConfigFileParser
const {set, get, isString} = require('lodash')
module.exports.handler = function (event, context, callback) {
const data = Buffer.isBuffer(event) ? JSON.parse(event) : event
const text = data.text || data.content
if (!text) {
const error = new Error('Invalid Arguments')
if (callback) {
callback(error, null)
}
@bruceCzK
bruceCzK / special-escape.js
Last active March 26, 2022 06:10
CK2SpecialEscapeNodeJs
// Ported from https://github.com/matanki-saito/EU4SpecialEscape/blob/master/ConsoleApplication3/ConsoleApplication3.cpp#L235
module.exports = function specialEscape(char, toUtf8, newVersion) {
// DO NOT escape valid char
if (char.codePointAt(0) < 256) {
return char
}
const hex = char.codePointAt(0).toString(16)
// default if UTF8, so hex is 4 length for most letters
// split low byte and high byte
// transform decimal to hex
@bruceCzK
bruceCzK / emojis.json
Created December 18, 2017 12:59 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "&#128104;&zw