Skip to content

Instantly share code, notes, and snippets.

View gucheen's full-sized avatar

Cheng Gu gucheen

View GitHub Profile
@gucheen
gucheen / typecho2hugo.js
Created January 13, 2021 02:06
export sqlite typecho posts to hugo. depends on del and better-sqlite3
const path = require("path");
const fs = require('fs');
const del = require('del');
const Database = require('better-sqlite3');
const db = new Database('typecho.db', { verbose: console.log, readonly: true });
const tmpFolder = path.resolve(__dirname, 'typecho2hugo');
if (fs.existsSync(tmpFolder)) {
del.sync(path.resolve(tmpFolder, '*'));
@gucheen
gucheen / change-git-profile.sh
Created August 28, 2020 09:09
easily change git profile
alias git_as_gucheng='git config user.name "Cheng Gu" && git config user.email "guchengf@gmail.com" && git config user.signingKey xxxxx'
@gucheen
gucheen / douyu-dark.css
Created April 9, 2020 14:32
douyu-dark.css
@-moz-document domain("www.douyu.com") {
.layout-Player-toolbar,
.layout-Player-asideMain,
.layout-Player-announce,
.ChatRank-rankWraper,
.FansRankInfo,
.ChatTabContainer-titleWraper--tabLi,
.ChatTabContainer-titleWraper--tabLi.is-active,
.layout-Player-barrage,
.PlayerToolbar-signCont {
interface ModernOrgTreeOptions {
container: HTMLElement;
nodes?: NodeList;
parentPosition?: string;
childPosition?: string;
}
export class ModernOrgTree {
parentsPositions = {};
svg;
@gucheen
gucheen / doc.css
Last active May 28, 2019 01:37
css for documentation
body,html{
margin:0
}
body{
padding:2em
}
a{
word-break:break-all
}
pre{
@gucheen
gucheen / generateQueryParams.js
Last active May 17, 2019 07:10
generate query params from object like URLSearchParams()
const generateQueryParams = (obj) => {
if (typeof obj !== 'object') {
return '';
}
const strs = [];
Object.keys(obj).forEach((key) => {
const k = encodeURIComponent(key);
const item = obj[key];
if (Array.isArray(item)) {
item.forEach((i) => {

软件

ack
aria2
asciinema
bat
ctags
curl
diff-so-fancy
fd
const request = require('request');
const util = require('util');
const fs = require('fs');
const path = require('path');
const os = require('os');
const get = util.promisify(request.get);
const post = util.promisify(request.post);
const sleep = (ms) => {
@gucheen
gucheen / index.html
Created August 9, 2018 09:44
Radio Toggle Switch
<fieldset class="radio-switch">
<legend>
Settings
</legend>
<input type="radio" name="lol" id="public">
<label for="public">
On
</label>
<input type="radio" name="lol" id="private">
@gucheen
gucheen / color-scheme-wsl.reg
Created May 19, 2018 14:04
color scheme for wsl
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
; 00BBGGRR, not RGB!
"ColorTable00"=dword:00000000 ; 0 - black
"ColorTable04"=dword:000000CD ; 1 - dark red
"ColorTable02"=dword:0000CD00 ; 2 - dark green
"ColorTable06"=dword:0000CDCD ; 3 - dark yellow
"ColorTable01"=dword:00EE0000 ; 4 - dark blue
"ColorTable05"=dword:00CD00CD ; 5 - dark magenta