Skip to content

Instantly share code, notes, and snippets.

View taoky's full-sized avatar
🔬
Rebooting...

taoky taoky

🔬
Rebooting...
  • University of Science and Technology of China
  • on USTC campus
  • 12:02 (UTC +08:00)
View GitHub Profile
@taoky
taoky / NOTE
Last active April 11, 2024 11:36
/proc/mdstat logic (Linux 6.7)
# md_seq_show
- printf("%s: %sactive", dev, active ? "" : "in")
- if active
- if rdonly then printf(" (read-only)")
- if autoread then printf(" (auto-read-only)")
- printf(" %s", raidtype)
- for each dev
- printf(" %pg[%d]", dev, nr)
- * NOTE: %pg is a special format that prints the device name
- if writemostly then printf("(W)")
@taoky
taoky / Cargo.toml
Last active March 28, 2024 18:17
wl_registry_add_listener example (Rust)
[package]
name = "globals"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
log = "0.4.21"
simple_logger = "4.3.3"
@taoky
taoky / psi-io-cg.sh
Created March 20, 2024 13:14
Show I/O PSI of cgroups
#!/bin/bash
CGROUP_PATH="/sys/fs/cgroup"
# Function to show IO PSI if avg10 is not 0 for a given cgroup
show_io_psi_if_needed() {
local cgroup_path=$1
local psi_file="${cgroup_path}/io.pressure"
if [ -f "${psi_file}" ]; then
@taoky
taoky / bluepause.py
Created December 7, 2023 08:23
Auto pause players when bluetooth headphones disconnect
#!/usr/bin/env python3
import dbus
from dbus.mainloop.glib import DBusGMainLoop
import gi.repository.GLib as glib
import os
def device_removed_callback(object_, interfaces):
if interfaces[-1] != "org.bluez.MediaPlayer1":
return
@taoky
taoky / dark.css
Created October 20, 2023 11:38
whiteglass theme dark CSS by darkreader
/*
_______
/ \
.==. .==.
(( ))==(( ))
/ "==" "=="\
/____|| || ||___\
________ ____ ________ ___ ___
| ___ \ / \ | ___ \ | | / /
| | \ \ / /\ \ | | \ \| |_/ /
@taoky
taoky / 41454b52dcb232a10b1af52e939798332cb415ed
Last active September 25, 2023 04:55
journalctl debugging
Considering root directory '/run/log/journal'.
Root directory /run/log/journal added.
Considering root directory '/var/log/journal'.
Root directory /var/log/journal added.
Considering directory '/var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394'.
Directory /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394 added.
Journal effective settings seal=no keyed_hash=yes compress=ZSTD compress_threshold_bytes=8B
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/system@22316234162f4e16a4208558d2318feb-0000000000af220d-0005fb7ebd5b49dc.journal added.
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/user-1000@5c9d6a903213438bbcfebd81e0c430d5-0000000000ae7364-0005fb7e9183b5da.journal added.
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/system@22316234162f4e16a4208558d2318feb-0000000000b2a9ea-0005fbb495eac39b.journal added.
@taoky
taoky / output
Created September 21, 2023 18:01
journalctl bug 2
> SYSTEMD_LOG_LEVEL=debug journalctl -b -1
Considering root directory '/run/log/journal'.
Root directory /run/log/journal added.
Considering root directory '/var/log/journal'.
Root directory /var/log/journal added.
Considering directory '/var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394'.
Directory /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394 added.
Journal effective settings seal=no keyed_hash=yes compress=ZSTD compress_threshold_bytes=8B
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/system@22316234162f4e16a4208558d2318feb-0000000000af220d-0005fb7ebd5b49dc.journal added.
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/user-1000@5c9d6a903213438bbcfebd81e0c430d5-0000000000ae7364-0005fb7e9183b5da.journal added.
@taoky
taoky / output
Created September 12, 2023 06:04
journalctl assertion
> SYSTEMD_LOG_LEVEL=debug journalctl -b -1
Considering root directory '/run/log/journal'.
Root directory /run/log/journal added.
Considering root directory '/var/log/journal'.
Root directory /var/log/journal added.
Considering directory '/var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394'.
Directory /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394 added.
Journal effective settings seal=no keyed_hash=yes compress=ZSTD compress_threshold_bytes=8B
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/system@22316234162f4e16a4208558d2318feb-00000000009fd362-0005fa2ea9e08fff.journal added.
File /var/log/journal/16d4ba3e7960484ca6a7dda49d8e5394/system@22316234162f4e16a4208558d2318feb-00000000009fdab9-0005fa2eaab216f6.journal added.
@taoky
taoky / interactive.py
Created August 25, 2023 09:52
Playing interactive ChatGLM2 with bigdl.llm (CPU)
# Deps:
# pip install bigdl-llm[all]
import torch
import time
import argparse
# import numpy as np
import readline
from bigdl.llm.transformers import AutoModel
from transformers import AutoTokenizer
@taoky
taoky / main.rs
Last active February 14, 2023 19:20
Debugging glib2 context sources
use std::{time::Duration, thread::sleep};
use zbus::blocking::Connection;
mod mutter;
fn main() {
let connection = Connection::session().unwrap();
let proxy = mutter::IdleMonitorProxyBlocking::new(&connection).unwrap();
for _ in 0..10000 {