Skip to content

Instantly share code, notes, and snippets.

@smiley-yoyo
smiley-yoyo / ubuntu_install_wecom.md
Last active March 28, 2026 07:00
Ubuntu下安装Wine和企业微信

Ubuntu下安装Wine和企业微信

Step 1: Install WineHQ on Ubuntu

  1. Enable 32-bit architecture:
sudo dpkg --add-architecture i386

Ubuntu20.04 Wine 6.0 微信中文显示方块/方框

如果希望在Ubuntu使用Windows版微信:

  1. 安装 Wine sudo apt-get install wine
  2. 先把环境改了省事:
    $ export WINEARCH=win32
    $ export WINEPREFIX=/home/qinyu/Wine/WeChat
  3. 创建 Wine Bottle
@smiley-yoyo
smiley-yoyo / .drone.yml
Created October 11, 2025 09:47
加快drone ci中docker构建速度
---
kind: pipeline
type: kubernetes
name: some-pipeline
steps:
- name: build_cache
image: plugins/docker
settings:
registry: some-registry.com
@smiley-yoyo
smiley-yoyo / delete-from-v2-docker-registry.md
Created September 3, 2025 03:46 — forked from jaytaylor/delete-from-v2-docker-registry.md
One liner for deleting images from a v2 docker registry

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
@smiley-yoyo
smiley-yoyo / get-argocd-default-password.md
Created July 24, 2025 02:51 — forked from iambryancs/get-argocd-default-password.md
Get ArgoCD default admin password

Get ArgoCD default admin password

To get ArgoCD default admin password after installation, run:

kubectl -n argocd get secret argocd-initial-admin-secret \
          -o jsonpath="{.data.password}" | base64 -d; echo

The default admin user is admin.

@smiley-yoyo
smiley-yoyo / text_vs_binary.go
Created April 16, 2025 12:25
Considering the definition of a binary file as "a computer file that is not a text file", they can differentiated by searching for the text/plain MIME in their MIME hierarchy.
package main
import (
"fmt"
"github.com/gabriel-vasile/mimetype"
)
func main() {
testBytes := []byte("This random text has a MIME type of text/plain; charset=utf-8.")
@smiley-yoyo
smiley-yoyo / join_test.go
Created December 20, 2024 07:25 — forked from dtjm/join_test.go
Benchmarking various ways of concatenating strings in Go
package join
import (
"fmt"
"strings"
"testing"
)
var (
testData = []string{"a", "b", "c", "d", "e"}
@smiley-yoyo
smiley-yoyo / addr_in_network.py
Last active October 23, 2024 07:19
python calc ip addr in network
import socket, struct
from ipaddress import ip_address, ip_network
# 错误代码,由于网络字节序为大字节序,而此代码试图使用小字节序处理掩码,因此当掩码不是刚好8的倍数时就会判断错误
def addr_in_network_wrong(ip, net_n_bits):
ipaddr = struct.unpack('<L', socket.inet_aton(ip))[0]
net, bits = net_n_bits.split('/')
netaddr = struct.unpack('<L', socket.inet_aton(net))[0]
netmask = ((1L << int(bits)) - 1)
return ipaddr & netmask == netaddr & netmask
@smiley-yoyo
smiley-yoyo / py-spy-record-top.sh
Created August 1, 2024 04:39
using py-spy record top cpu usage python program
#!/bin/bash
output=$1
if [ -z "$output" ]; then
output="profile.svg"
fi
# assume that the top usage program is python program, or you can customize the top command
# using head/tail to get the top 1 line (the first 8 are headers)
@smiley-yoyo
smiley-yoyo / parse_query.go
Last active July 3, 2024 06:17
parse query to map[string]any with gin
import (
"github.com/gin-gonic/gin"
)
type QueryMap map[string]any
func ParseQuery(c *gin.Context) (QueryMap, error) {
query := make(QueryMap)
if c.Request.Method == "GET" {
for k, v := range c.Request.URL.Query() {