Skip to content

Instantly share code, notes, and snippets.

View mistivia's full-sized avatar

小葉薜荔 mistivia

View GitHub Profile
@mistivia
mistivia / libfcgi-example.c
Created December 10, 2024 07:30 — forked from dermesser/libfcgi-example.c
In case anyone wants to see a multi-threaded FastCGI application written with the fcgiapp library.
# include <stdlib.h>
# include <stdio.h>
# include <sys/stat.h>
# include <pthread.h>
# include <fcgiapp.h>
const char* const sockpath = "/tmp/fcgicpp.sock";
@mistivia
mistivia / keys
Last active December 1, 2024 08:14
IceWM config
key "Super+Return" xfce4-terminal -x bash -c 'cd ; exec bash -l'
key "Super+r" runcmd
key "Super+v" volume
key "Super+Shift+s" flameshot gui
@mistivia
mistivia / dhcpd.conf
Last active November 26, 2024 03:31
Tap Network with NAT for QEMU
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.50.0 netmask 255.255.255.0 {
option domain-name-servers 8.8.8.8, 8.8.4.4;
option routers 192.168.50.1;
option subnet-mask 255.255.255.0;
range 192.168.50.100 192.168.50.200;
}
@mistivia
mistivia / define-macro.scm
Created November 21, 2024 02:03
procedure macro in chicken scheme
(import (chicken syntax))
(define-syntax define-macro
(er-macro-transformer
(lambda (exp r c)
(let ((def (cadr exp))
(body (cddr exp)))
`(define-syntax ,(car def)
(er-macro-transformer
(lambda (e2 r2 c2)
@mistivia
mistivia / tex2jpg.sh
Created September 1, 2024 08:32
convert latex formula to jpeg image
#!/bin/bash
# usage: echo '$$E=mc^2$$' | tex2jpg out.jpg
PPWD=$(pwd)
DIR=/tmp/$(head -c10 /dev/urandom | base32)
mkdir -p $DIR
cd $DIR && \
echo '\documentclass{minimal}' > input.tex && \
@mistivia
mistivia / longdoc-template.typ
Last active December 1, 2024 08:02
typst template for documents
// typst compile doc-template.typ
// Output: doc-template.pdf
#set text(font: (
"Libertinus Serif",
"Source Han Serif",
))
#set heading(numbering: "1.")
#set page(
paper: "a4",
@mistivia
mistivia / my-guile.sh
Created April 5, 2024 04:38
fitler guile's auto compile message
#!/bin/bash
exec rlwrap /usr/bin/guile "$@" 2> >(grep -E -v '^;;; ' >&2)
;; This is a new version of pmatch (August 8, 2012).
;; It has two important new features:
;; 1. It allows for a name to be given to the pmatch if an error ensues.
;; 2. A line from the specification has been removed. (see below). Without
;; that line removed, it was impossible for a pattern to be (quote ,x),
;; which might be worth having especially when we write an interpreter
;; for Scheme, which includes quote as a language form.
;;; Code written by Oleg Kiselyov
;; (http://pobox.com/~oleg/ftp/)
@mistivia
mistivia / blog-font.css
Created March 17, 2024 08:39
font config of my blog
@font-face {
font-family: "sans-chinese";
src: local("WenQuanYi Micro Hei"), local("PingFang SC"), local("Noto Sans SC"), local("Noto Sans CJK SC"), local("Source Han Sans CN"), local("Microsoft YaHei"), local("PingFang TC"), local("Noto Sans TC"), local("Noto Sans CJK TC"), local("Source Han Sans TW"), local("Microsoft JhengHei"), local("sans-serif");
unicode-range: U+2000-FFFF
}
body {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", sans-chinese, monospace;
// ....
}
@mistivia
mistivia / define-macro.scm
Last active March 7, 2024 11:06 — forked from yuhr/macro.ss
macro.ss: Defining macros simply on chez scheme.
;; Defining macros simply on chez scheme. This code is in the public domain.
(define-syntax define-macro
(syntax-rules ()
((k (name . args) body ...)
(define-macro name (lambda args body ...)))
((k name transformer)
(define-syntax name
(lambda (stx)
(syntax-case stx ()