Skip to content

Instantly share code, notes, and snippets.

View fuweid's full-sized avatar
🎯
Focusing

Fu Wei fuweid

🎯
Focusing
View GitHub Profile
@fuweid
fuweid / gist:de5e21012f7eba2b7b2d694f1a8ea20a
Created September 17, 2022 10:26 — forked from simonheb/gist:b54b91358c3d7e2960a4f6e13e95ac54
Patching the 5.12 Linux kernel to support new Intel hardware (e.g., Intel Iris Xe for Thinkpad X1 Titanium Yoga) on Ubuntu/Debian/Pop!_OS

Get a 5.12 Linux kernel with support for newer Intel hardware (e.g., Intel Iris Xe for Thinkpad X1 Titanium Yoga) on Ubuntu/Debian/Pop!_OS

Prologue: Do I need this?

I recently got a Thinkpad sporting an Intel® Core™ i5-1140G7 Processor 11. gen (1,80 GHz, Turbo Boost, 4 Cores, 8 Threads, 8 MB Cache with an Integrated Intel® Iris® Xe. Sadly graphics drivers did not work out-of-the-box and also not with the latets 5.12 kernel from xenmod. You can tell it's not working when graphics are slow, backlight adjustment buttons don't work and this is the output of inxi -G (you might need to sudo apt install inxi):

simon@pop-os:~$ inxi -G
Graphics:
  Device-1: Intel driver: N/A 
  Device-2: IMC Networks Integrated Camera type: USB driver: uvcvideo 
  Display: x11 server: X.Org 1.20.9 driver: fbdev unloaded: modesetting,vesa 
 resolution: 2256x1504~95Hz 
const std = @import("std");
const StrangeStruct = struct {
// A: ?i8,
B: ?i8,
};
pub fn main() anyerror!void {
var t = try autoAssign(StrangeStruct);
std.log.err("{}", .{t});
@fuweid
fuweid / main.go
Created July 4, 2022 14:59
testing-pagecache
package main
import (
"fmt"
"log"
"os"
"os/signal"
cgroupsv2 "github.com/containerd/cgroups/v2"
)
@fuweid
fuweid / running_the_kernel.md
Created July 3, 2022 09:11 — forked from adwait1-g/running_the_kernel.md
This gist tells you how to build the kernel and run it on qemu. This is also a way to get started with kernel's internals.

1. Downloading and building the Linux kernel

  1. Clone the github repository onto your local machine.
$ git clone https://github.com/torvalds/linux.git
$ cd linux
  1. Configure the build
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@fuweid
fuweid / fixup_committer_date.sh
Created February 20, 2022 10:26 — forked from bfoz/fixup_committer_date.sh
Force GIT_COMMITTER_DATE = GIT_AUTHOR_DATE
git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"'
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
package selftest
import (
"encoding/hex"
"encoding/json"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"testing"
@fuweid
fuweid / note.md
Last active August 19, 2021 16:34
ShimV2 has race condition when it cleanups task bundle.

ShimV2 has race condition when it cleanups task bundle. There are several cases.

First one is about defer rollback bundle when NewTask fails.

// https://github.com/containerd/containerd/blob/main/runtime/v2/manager.go#L127
func (m *TaskManager) Create(ctx context.Context, id string, opts runtime.CreateOpts) (_ runtime.Task, retErr error) {
	bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec.Value)
	if err != nil {
 return nil, err
@fuweid
fuweid / truecolor.bash
Created January 31, 2021 14:43
True Color in Screen
#!/usr/bin/env bash
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
for (colnum = 0; colnum<77; colnum++) {
r = 255-(colnum*255/76);
g = (colnum*510/76);
b = (colnum*255/76);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;