Skip to content

Instantly share code, notes, and snippets.

View mahaidong's full-sized avatar
🏠
Working from home

ma haidong mahaidong

🏠
Working from home
View GitHub Profile
@mahaidong
mahaidong / QEMU_ON_M1.md
Created November 29, 2022 02:36 — forked from citruz/QEMU_ON_M1.md
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@mahaidong
mahaidong / xim_example.c
Created September 10, 2022 13:59 — forked from Determinant/xim_example.c
A minimal example for X Input Method.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <assert.h>
Display *dpy;
Window win;

How to setup a minimal X11 environment on Debian GNU/Linux

  1. Install the following packages

    • xserver-xorg-core (server)
    • xserver-xorg-video-XXX (video driver, XXX depends on your hardware)
    • xserver-xorg-input-XXX (input device driver, XXX depends on your hardware. evdev works well for most cases)
    • x11-xserver-utils (xmodmap, xrandr)
    • x11-xkb-utils (setxkbmap)
  • x11-utils (xdpyinfo, xev, xkill, xprop, xwininfo)
@mahaidong
mahaidong / Triangulate.py
Created July 11, 2021 17:18 — forked from Shaptic/Triangulate.py
Fokin' triangulation.
"""
Triangluation simulator.
Left mouse button: place a vertex.
Right mouse button: finalize a shape.
T: triangulate shapes.
"""
import math
from random import randint
@mahaidong
mahaidong / interp1.lisp
Created October 31, 2019 11:02 — forked from mnicky/interp1.lisp
simple Scheme interpreter, including macros, by Peter Norvig
;source: http://norvig.com/paip/interp1.lisp
;;; -*- Mode: Lisp; Syntax: Common-Lisp; -*-
;;; Code from Paradigms of Artificial Intelligence Programming
;;; Copyright (c) 1991 Peter Norvig
;;; File interp1.lisp: simple Scheme interpreter, including macro.sgi
(defun interp (x &optional env)
"Interpret (evaluate) the expression x in the environment env."