Skip to content

Instantly share code, notes, and snippets.

View pseudocc's full-sized avatar
☘️
unlucky

Atlas Yu pseudocc

☘️
unlucky
View GitHub Profile
@pseudocc
pseudocc / cold-boot-test-init.sh
Created September 19, 2025 09:22
Create a user systemd service to automate a cold boot cycle test, use "rtcwake -mno" under the hood.
#!/bin/bash -e
# vim: ts=2:et:tw=80
# From: https://github.com/pseudocc/pseudosh/blob/main/utils.sh
# This script is a bash library that provides environment variables and functions
# for the common csi sequence. The csi sequence is the control sequence introducer
# that is used to control the terminal.
export BLACK=0
export RED=1
/**
* @file eddystone_scanner.c
* @brief A C program to scan for Eddystone-URL beacons on Linux.
*
* This program uses the BlueZ library to perform a Bluetooth Low Energy scan,
* filter for Eddystone advertisement packets, decode the URL frame, and
* exits as soon as the first URL is found. This version uses recv() with a
* socket timeout instead of select().
*
* @author Gemini
@pseudocc
pseudocc / umad.c
Created October 27, 2024 22:01
A simple linux uinput program to randomly generate input events including key presses, mouse movements.
/**
* umad.c - A simple uinput program to randomly generate input events
* including key presses, mouse movements.
*
* Author: 2024, Atlas Yu <atlas.yu@canonical.com>
* SPDX-License-Identifier: GPL-2.0 (inherited from linux/uinput.h)
*
* vim: ts=8 sw=8 noet
**/
@pseudocc
pseudocc / install-proposed-pkgs.sh
Last active April 26, 2024 04:54
Bash script to install packages from ubuntu proposed channel.
#!/bin/bash
# vim: noet:ts=4:tw=80
# Author: Atlas Yu <atlas.yu@canonical.com>
# Copyright: 2024 Canonical Ltd
# License: MIT
_info() {
>&2 echo "$@"
}
@pseudocc
pseudocc / f64-repr.c
Last active October 18, 2023 03:47
64-bit floating point representation
#include "stdio.h"
#include "stdlib.h"
// assume running on little-endian machine
typedef union {
double direct;
struct __attribute__((packed)) {
unsigned long mantissa : 52;
signed exponent : 11;
unsigned sign : 1;
@pseudocc
pseudocc / thread-tryout.zig
Created August 24, 2023 04:49
zig 0.11.0 std.Thread Example
const std = @import("std");
fn worker_thread(mutex: *std.Thread.Mutex, accum: *u32, version: *u32) !void {
while (true) {
mutex.lock();
defer mutex.unlock();
accum.* += 1;
if (accum.* >= 100) {
version.* = 0;
break;
@pseudocc
pseudocc / real-prog-dvorak.kbd.json
Last active May 23, 2023 08:29
real-prog-dvorak
[
{
"backcolor": "#ebebeb",
"name": "real-prog-dvorak",
"author": "Atlas Yu",
"background": {
"name": "PBT WCS",
"style": "background-image: url('/bg/plastic/pbt-wcs.png');"
}
},