Skip to content

Instantly share code, notes, and snippets.

View typeless's full-sized avatar

Mura Li typeless

  • Castles Technology Co., Ltd.
  • New Taipei City, Taiwan
View GitHub Profile
@typeless
typeless / gist:e4aa8ff8a72baa2cad5c75ea52cc8259
Created December 26, 2022 10:50
Sed regex parsing shared libraries filename on Linux
sed --debug -n 's/lib\([^.]\+\)\.so\(\.[0-9]\+\)\(\.[0-9]\+\)\(\.[0-9]\+\)/\1/p'
@typeless
typeless / Tuprules.tup
Created December 22, 2022 03:01
Tup Tupfile Tuprules.tup example
ROOT = $(TUP_CWD)
BUILD = $(TUP_VARIANTDIR)
VENDOR_LIB_ROOT = $(ROOT)/thirdparty/mh1903
PLATFORM_FLAGS += -march=armv7e-m+fp -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
PLATFORM_FLAGS += -mno-thumb-interwork
CFLAGS += -g
@typeless
typeless / pre-receive.sh
Created December 22, 2022 02:57
Git hooks pre-receive checks trailers
#!/bin/bash
echo "Checking commit messages..."
# Iterate over the pushed commits
while read old_rev new_rev refname; do
# Get the list of commits being pushed
commits=$(git rev-list --reverse $old_rev..$new_rev)
# Iterate over the commits
for commit in $commits; do
@typeless
typeless / build-gitea.sh
Last active December 20, 2022 05:58
Build Gitea with statically linked Musl libc, suitable for running on a NAS
CC=musl-gcc LDFLAGS='--linkmode external --extldflags "-static"' TAGS='bindata sqlite sqlite_unlock_notify' make build
@typeless
typeless / setup.sh
Created December 12, 2018 09:48
libreswan ipsec.conf
#!/bin/bash -euxo pipefail
PUBLIC_IP=$1
OUT_DIR=${PWD}/out
ETC_DIR=${OUT_DIR}/etc
mkdir -p ${ETC_DIR}/ipsec.d
cat >> ${ETC_DIR}/ipsec.conf <<EOF
@typeless
typeless / deptree.go
Last active May 4, 2016 06:54
Deptree - Generating symbol dependency and accumulative size information in JSON
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"log"
"os"
)