Skip to content

Instantly share code, notes, and snippets.

View zengxs's full-sized avatar

Xiangsong Zeng zengxs

  • Singapore/London
  • 18:47 (UTC +08:00)
View GitHub Profile
@zengxs
zengxs / avalonia-macime-polyfill.js
Created November 3, 2025 07:27
A polyfill to fix input method (IME) problems for Avalonia apps running on WebAssembly in macOS browsers.
(function () {
// 仅在 Apple 浏览器上启用
if (!navigator.userAgent.match(/(macintosh|macintel|macppc|mac68k|macos)/i)) return;
let stateMap = new WeakMap();
function getState(el) {
let s = stateMap.get(el);
if (!s) {
s = {composing: false, lastData: null};
stateMap.set(el, s);
@zengxs
zengxs / find-macosx-sdk.sh
Created November 21, 2024 03:46
Automates download macOS SDK for cross build macOS apps on Linux.
#!/bin/sh
#
# Author: Xiangsong Zeng
# Date: 2024-11-21
# Description:
# This script is used to download the macOS SDK from the
# internet for provide a way to cross-compile macOS apps
# on Linux. This is useful for developers who want to
# build macOS apps on CI servers that run Linux.
#
@zengxs
zengxs / kafka_sasl_consumer.go
Last active November 12, 2024 08:53
Golang Kafka Consumer with SASL Auth
package main
import (
"context"
"fmt"
"log"
"strings"
// An EOF error always occurs when using the IBM/sarama, but segmentio/kafka-go works fine
"github.com/segmentio/kafka-go"
@zengxs
zengxs / convert-svg.py
Created September 12, 2023 09:00
Convert SVG to Axure-compatible SVG using AppleScript and Pixelmator Pro.
#!/usr/bin/env python3
"""
Convert SVG to Axure-compatible SVG using AppleScript and Pixelmator Pro.
Axure convert optimized SVG to Shape will cause the SVG to be rendered deformed.
This script uses Pixelmator Pro to convert SVG to pixel-based SVG, which Axure
will convert to Shape correctly.
"""
import argparse
#!ipxe
# AlmaLinux Operating System
# https://almalinux.org/
isset ${dhcp-server} && set ipparam ip=dhcp || set ipparam ip=${ip}::${gateway}:${netmask}:::none nameserver=${dns}
set ipparam BOOTIF=${netX/mac} ${ipparam}
goto ${menu} ||
# /etc/systemd/system/[email protected]
[Unit]
Description=GO Simple Tunnel - %i
After=network.target
[Service]
Type=simple
User=nobody
Group=nogroup
@zengxs
zengxs / App.vue
Created May 13, 2021 03:20
rust server side render (ssr) bench
<template>
<div id="app">
<h1>Hello</h1>
</div>
</template>
<script>
export default {
name: "App",
};
%YAML 1.2
---
# https://www.sublimetext.com/docs/3/syntax.html
name: Nim
file_extensions: [nim, nims]
scope: source.nim
contexts:
main:
- include: comments
@zengxs
zengxs / renew-ssl.sh
Created February 1, 2021 03:53
SSL certificates renew script for ZeroSSL using lego.
#!/bin/sh
export CLOUDFLARE_EMAIL='[REDACT: your cloudflare email]'
export CLOUDFLARE_API_KEY='[REDACT: your cloudflare api key]'
lego \
--server https://acme.zerossl.com/v2/DV90 \
--accept-tos \
--path /srv/lego \
--eab \
#!/usr/local/bin/ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."