Skip to content

Instantly share code, notes, and snippets.

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

Sheldon Qi xdqi

🏠
Working from home
  • 11:31 (UTC +08:00)
View GitHub Profile

Just got my new YOGA Air 14 Ultra (Core Ultra X9 388H+64G RAM+2T SSD).

btw, the process should work for Yoga Slim 7i Ultra Aura as well.

However Ubuntu doesn't work out of box, especially keyboard and sound.

When you install Ubuntu via USB, disable secure boot and use the touch keyboard from accessibility menu.

Keyboard

@xdqi
xdqi / grub-mount-macos.sh
Last active January 2, 2023 07:06
Compile GRUB mount on macOS
#!/bin/bash -x
# install macfuse from osxfuse.github.io
# brew install autoconf automake objconv
git clone https://git.savannah.gnu.org/git/grub.git
cd grub
./bootstrap
./configure --disable-nls --disable-werror
make || make grub-mount grub-fstest
@xdqi
xdqi / rand.cpp
Created November 19, 2022 01:53
Random double between [0.5,1)
#include <cstdio>
#include <cstdint>
// generates random number between [0.5, 1)
double getrand(FILE *f) {
union {
uint64_t u;
double d;
};
fread(&u, sizeof(u), 1, f);
@xdqi
xdqi / 0001-Add-IPIP-geolocation-display-to-GNU-inetutils.patch
Created April 18, 2017 06:58
Add IPIP geolocation display to GNU inetutils
From 68a83385a5f2dd2a1f33e775366fabd2fe0c0edc Mon Sep 17 00:00:00 2001
From: Alexander Qi <xdqi@users.noreply.github.com>
Date: Tue, 18 Apr 2017 14:55:08 +0800
Subject: [PATCH] Add IPIP geolocation display to GNU inetutils
---
ping/ping_echo.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++-
src/traceroute.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 198 insertions(+), 10 deletions(-)
@xdqi
xdqi / 0001-Add-IPIP-geolocation-display-to-BIND-9.11.0-P3.patch
Created April 18, 2017 06:09
Add IPIP geolocation display to BIND 9.11.0-P3.patch
From 42081ef76faf196ca354622a18885f3f7677ded5 Mon Sep 17 00:00:00 2001
From: Alexander Qi <xdqi@users.noreply.github.com>
Date: Tue, 18 Apr 2017 14:05:03 +0800
Subject: [PATCH] Add IPIP geolocation display to BIND-9.11.0-P3
---
bin/dig/nslookup.c | 3 +-
lib/dns/rdata.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 96 insertions(+), 2 deletions(-)
@xdqi
xdqi / add-ipip-geolocation-to-mtr.patch
Created April 18, 2017 03:26
Add ipip.net database to MTR
From 1d43349759ffdf9b9d7e4961d1326119dd6c44c0 Mon Sep 17 00:00:00 2001
From: Alexander Qi <xdqi@users.noreply.github.com>
Date: Tue, 18 Apr 2017 11:24:28 +0800
Subject: [PATCH] Add IPIP support
---
.gitignore | 2 ++
Makefile.am | 4 ++-
configure.ac | 2 +-
ipip/ipip.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@xdqi
xdqi / compress.py
Created June 5, 2015 04:22
QZIP tools
#!/usr/bin/env python3
import sys
import os
import struct
import codecs
import PyQt4.QtCore
directory_path = sys.argv[1]
filenames = []
@xdqi
xdqi / Notify.py
Created February 10, 2015 08:53
Implement minimum python-notify2 API using pync
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# WeCase -- This file implemented Notify.
# Copyright (C) 2013, 2014, 2015 The WeCase Developers.
# License: GPL v3 or later.
from PyQt4 import QtCore
import path
@xdqi
xdqi / client.py
Last active November 19, 2022 01:55
a ZGCD-compatible client
#!/usr/bin/python
# ZGCD client
# Contributor: Kirito <h@kirito.me>
# License: MIT
# TODO: urllib* compability
try:
import requests # requests is a humanic REST library
REST_LIBRARY = 'requests'
@xdqi
xdqi / getktxp.py
Created April 1, 2014 05:21
Print all magnet links on a KTXP search page
#!/usr/bin/env python
# Using: getktxp.py [KTXP Search Page URL]
# TODO:
# 1. Merge it with lixian-cli
# 2. Support Multi Pages (I did not implement that because typical anime series has less than 30 episodes)
import sys
from bs4 import BeautifulSoup
import requests
import urllib