Skip to content

Instantly share code, notes, and snippets.

@gucheen
gucheen / RenewExpiredGPGkey.md
Created January 12, 2026 09:26 — forked from TheSherlockHomie/RenewExpiredGPGkey.md
Updating expired GPG keys and backing them up 🔑🔐💻

Updating expired GPG keys and their backup 🔑🔐💻

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object
@gucheen
gucheen / RenewExpiredGPGkey.md
Created January 12, 2026 09:26 — forked from TheSherlockHomie/RenewExpiredGPGkey.md
Updating expired GPG keys and backing them up 🔑🔐💻

Updating expired GPG keys and their backup 🔑🔐💻

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object
:root {
--primary-color: #2c3e50;
--bg-color: #f8f9fa;
--body-background: #f8f9fa;
--text-color: #333333;
--meta-color: #666666;
--border-color: #e9ecef;
--header-bg: #ffffff;
--hover-color: #d71a1b;
--summary-color: #6c757d;
@gucheen
gucheen / landing.html
Created January 26, 2024 02:03
b.guchengf.me landing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Be Bold Creative Strategic</title>
<style>
* {
font-family: sans-serif;
@gucheen
gucheen / pinboard-json-to-netscape-html.js
Created August 15, 2023 13:34
convert pinboard json data to standard netscape html bookmarks
import fs from 'fs'
const rawFile = 'bookmarks.json'
const outputHTML = 'bookmarks.html'
const pinboardData = JSON.parse(fs.readFileSync(rawFile).toString())
fs.writeFileSync(outputHTML, `<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--This is an automatically generated file.
It will be read and overwritten.
@gucheen
gucheen / index.html
Created March 17, 2021 03:07
BrowserView-dragging-problem
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<style>
*,
*::after,
*::before {
@gucheen
gucheen / format-amount.ts
Created January 26, 2021 09:50
morden-elegant-way-to-format-currency-in-js
const amountFormatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'CNY' })
/**
* 1234567.12 to 1,234,567.12
* @param amount
*/
export const formatAmount = (amount: number): string => {
if (typeof amount === 'undefined') {
return ''
}
@gucheen
gucheen / fix-hugo-md-file-time.js
Created January 21, 2021 06:15
fix hugo md files' time by its created time
// hugo list all > posts.csv
/*
When you export your markdown files from other application or system,
Files' created time will be incorrect.
This script fix these time by its date from hugo front matter.
works by `touch` command
*/
const fs = require('fs')
const path = require('path')
@gucheen
gucheen / fnm-arm64.sh
Last active December 2, 2021 16:58
fnm: install arm64 version of node from homebrew bottles
#!/bin/bash
# assume that you have installed homebrew, wget and fx(https://github.com/antonmedv/fx)
# do all things in /tmp
mkdir -p /tmp/fnm-node;
pushd /tmp/fnm-node;
# clean tmp
rm -fr ./*;
mkdir fnm;
@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, '*'));