Skip to content

Instantly share code, notes, and snippets.

View hucsmn's full-sized avatar
💭
I may be slow to respond.

hucsmn hucsmn

💭
I may be slow to respond.
View GitHub Profile
@hucsmn
hucsmn / convmv_shift_jis.py
Last active March 31, 2018 01:28
批量转换日文zip解压产生的文件名乱码的 python3 脚本
# 批量转换日文zip解压产生的文件名乱码
# 确保 python3 已安装,把乱码文件拖到这个脚本上即可
import sys, os
for dir in sys.argv[1:]:
for root, dirs, files in os.walk(dir, topdown=False):
print("[%s]" % root)
for src in dirs+files:
dst = src.encode('mbcs').decode('shift_jisx0213')
@hucsmn
hucsmn / httpshare.go
Last active February 28, 2020 05:17
简易的HTTP文件夹分享
/* Simple HTTP file sharing service */
package main
import (
"flag"
"fmt"
"html/template"
"net/http"
"os"
@hucsmn
hucsmn / runedump.go
Last active August 29, 2015 14:05
查看标准输入 (UTF-8) 里每个字符的 Unicode 编号,类似于 od
/* 查看标准输入 (UTF-8) 里每个字符的 Unicode 编号,类似于 od */
package main
import (
"bufio"
"fmt"
"io"
"os"
)
@hucsmn
hucsmn / sync-github-lastest.py
Created August 30, 2015 11:54
自动下载 github 上的软件
#!/usr/bin/env python3
import sys, os, subprocess, time
import re, json
from collections import namedtuple
from urllib.request import urlopen
class AddressError(Exception): pass
class DownloadError(Exception): pass
@hucsmn
hucsmn / embed.go
Last active January 29, 2018 13:58
go generate 工具,嵌入文本文件内容
// embed.go: go generate tool for embedding text files
//TODO: file preprocessors (using os/exec), concurrent workers
package main
import (
"bytes"
"flag"
"fmt"
@hucsmn
hucsmn / gopath-upgrade.sh
Created April 23, 2018 09:55
auto update all sources and commands
(
cd $GOPATH;
find src '(' -name '.git' -o -name '.hg' ')' -type 'd' | perl -lpe 's{^src/(.+)/.(?:git|hg)$}{$1}' | xargs go get -u -insecure -v;
find src -name 'cmd' -type 'd' | perl -lpe 's{^src/(.+)$}{$1/...}' | xargs go install -v
)
@hucsmn
hucsmn / output.txt
Created January 20, 2019 10:54
Unicode case folding pitfall
'µ' (00b5): upper 'Μ' (039c) [ulu: 'Μ' (039c)], lower 'µ' (00b5) [lul: 'μ' (03bc)]
'İ' (0130): upper 'İ' (0130) [ulu: 'I' (0049)], lower 'i' (0069) [lul: 'i' (0069)]
'ı' (0131): upper 'I' (0049) [ulu: 'I' (0049)], lower 'ı' (0131) [lul: 'i' (0069)]
'ſ' (017f): upper 'S' (0053) [ulu: 'S' (0053)], lower 'ſ' (017f) [lul: 's' (0073)]
'ς' (03c2): upper 'Σ' (03a3) [ulu: 'Σ' (03a3)], lower 'ς' (03c2) [lul: 'σ' (03c3)]
'ϐ' (03d0): upper 'Β' (0392) [ulu: 'Β' (0392)], lower 'ϐ' (03d0) [lul: 'β' (03b2)]
'ϑ' (03d1): upper 'Θ' (0398) [ulu: 'Θ' (0398)], lower 'ϑ' (03d1) [lul: 'θ' (03b8)]
'ϕ' (03d5): upper 'Φ' (03a6) [ulu: 'Φ' (03a6)], lower 'ϕ' (03d5) [lul: 'φ' (03c6)]
'ϖ' (03d6): upper 'Π' (03a0) [ulu: 'Π' (03a0)], lower 'ϖ' (03d6) [lul: 'π' (03c0)]
'ϰ' (03f0): upper 'Κ' (039a) [ulu: 'Κ' (039a)], lower 'ϰ' (03f0) [lul: 'κ' (03ba)]
@hucsmn
hucsmn / InstallGoTools.cmd
Last active January 26, 2020 11:04
VSCode Go tools installation work around (solving problem that `go get golang.org/x/tools` was blocked by GFW)
@echo off
echo [work around golang.org/x/*]
cd "%GOPATH%"
if not exist src\golang.org\x mkdir src\golang.org\x
cd src\golang.org\x
for %%i in (tools mod lint sync xerrors) do (
echo update golang.org/x/%%i
if not exist %%i (
@hucsmn
hucsmn / @usage.md
Last active October 7, 2019 12:07
Compare binary data in terminal, which could be helpful for debugging

Place hexcmp.rs in a crate, as a module of some code like:

#[macro_use]
mod hexcmp;

use hexcmp::*;

fn main() {
    // sample data
@hucsmn
hucsmn / ArchServerInstallNotes.md
Last active March 6, 2020 10:44
A record of my installation steps of Arch Linux on a KVM-based VPS server via Live CD.

Arch Linux server installation notes

This article is a record of my own installation steps of Arch Linux on a KVM-based VPS server via Live CD.

The VPS was finally configured to a web server + proxy server + testing machine for development.

Presumptions:

  • x86_64, KVM-based VPS
  • VPS provider allows customed ISO