Skip to content

Instantly share code, notes, and snippets.

@yougg
yougg / tree.zig
Created July 31, 2025 02:05
ziglang simple implementation for print file tree
// zig version: 0.14.1+
const std = @import("std");
const Entry = struct {
name: []const u8,
kind: std.fs.Dir.Entry.Kind,
};
pub fn main() !void {
@yougg
yougg / tree.go
Created December 5, 2024 01:16
golang simple implementation for print file tree
//go:generate go build -trimpath -ldflags "-s -w" -o tree${GOEXE} ${GOFILE}
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
)
@yougg
yougg / command.md
Created April 4, 2022 12:53
Command Note

Command Note

软路由

@yougg
yougg / topics.go
Created March 11, 2021 09:09
list/create kafka topic in go
//go:generate go env -w CGO_ENABLED=0 GOPROXY="https://goproxy.cn|https://goproxy.io|direct"
//go:generate rm go.*
//go:generate go mod init kafka.topic
//go:generate go mod tidy
//go:generate go build -trimpath -buildmode pie -installsuffix netgo -tags "osusergo netgo static_build" -ldflags "-s -w -extldflags '-static'" ${GOFILE}
package main
import (
"flag"
"fmt"
@yougg
yougg / monitor.go
Last active April 25, 2021 02:55
Simple monitor for running multi process in docker scratch image
//go:generate go build -trimpath -buildmode pie -installsuffix netgo -tags "osusergo netgo static_build" -ldflags "-s -w -extldflags '-static'" -o monitor ${GOFILE}
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
@yougg
yougg / qq_nickname.md
Last active March 25, 2020 14:42
通过QQ空间个人资料修改QQ昵称为空格过程记录
  1. 登陆自己的QQ空间 https://qzone.qq.com/

  2. 进入个人档,点击修改基本资料

  3. 在昵称处填入一个到多个Unicode空格

  4. 点击最下方的保存按钮,此时会弹框提示很抱歉,昵称不能全为空,请重新输入

    • 按Chrome F12或者Ctrl+Shift+I快捷键打开开发者工具窗口
  • 进入Network标签页,先点击Clear清理一下之前的请求记录
@yougg
yougg / hibernate.md
Last active December 16, 2020 04:16
Ubuntu 19.04 enable hibernate

Enable hibernate with swapfile on Ubuntu 19.04

Install hibernate and other dependencies which are needed to hibernate

sudo apt install hibernate

Create the swap file

@yougg
yougg / dump.go
Created August 16, 2019 08:39
Dump goroutine stack by signal
package dump
import (
"fmt"
"os"
"os/signal"
"runtime"
"syscall"
)