Skip to content

Instantly share code, notes, and snippets.

View CodingKoopa's full-sized avatar
💜

Koopa CodingKoopa

💜
View GitHub Profile
@CodingKoopa
CodingKoopa / notes.md
Created March 26, 2024 05:38
ntfs permission stuff
  1. setup user mapping with ntfs-3g
  2. fix user: chown -R koopa:koopa .
  3. in windows, make sure that subfolder + file permissions are being inherited from the root
  4. in linux, fix file perms: find . -type f -print0 | sudo xargs -0 chmod 644
    • add execute perms within steam library
  5. in linux, fix dir perms: find . -type d -print0 | sudo xargs -0 chmod 755

at this point, things should pretty much be working: newly created documents are rw for the owner (shared between windows and linux), and can optionally be made executable

however, linux creates them as 644, whereas windows-created files show up in linux as 600

@CodingKoopa
CodingKoopa / ntstatus.h
Created March 9, 2024 03:33
MinGW headers (distributed w/ Cygwin)
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*
* The status values have been taken from
* http://msdn.microsoft.com/en-us/library/cc704588.aspx
* except for the small group of values below.
*/
#ifndef _NTSTATUS_
@CodingKoopa
CodingKoopa / article.md
Last active March 4, 2024 21:37
Virtual memory in practice

Virtual memory in practice

Hiya! This article will draw some connections between the mechanics of virtual memory and the funny numbers that you see in your operating system's task manager. We will talk about basic systemwide memory statistics as well as per-process properties. The main contribution of this article is illustrating the similarities between Windows and Linux in a way that can be observed using a couple of systems and some curiosity.

Terminology

TODO: Linux does use "commit" in the same way. also, talk about optimistic malloc

TODO: consider https://sw.kovidgoyal.net/kitty/faq/#i-opened-and-closed-a-lot-of-windows-tabs-and-top-shows-kitty-s-memory-usage-is-very-high

@CodingKoopa
CodingKoopa / bootmain.c
Last active February 25, 2023 05:35
dumb attempt at xv6 bootloader reporting progress over serial (needs to be compiled with `-Os`) [might not actually be correct lol]
// Boot loader.
//
// Part of the boot block, along with bootasm.S, which calls bootmain().
// bootasm.S has put the processor into protected 32-bit mode.
// bootmain() loads an ELF kernel image from the disk starting at
// sector 1 and then jumps to the kernel entry routine.
#include "types.h"
#include "elf.h"
#include "x86.h"
@CodingKoopa
CodingKoopa / xv6-boot.md
Last active February 26, 2023 07:35
SeaBIOS/xv6 stuff

xv6 boot

boot process

mainly just considering PATA/IDE (QEMU's default interface of choice)

glosses over memory model

Boot process:

@CodingKoopa
CodingKoopa / 00_readme.md
Last active February 20, 2023 22:27
xkb layout switching issue

I am trying to switch between my default keyboard layout (US, QWERTY) to an alternate layout (US, Dvorak Programmer). I have produced an Xorg config to set this up, but the toggle doesn't work, and the generated source from xkbcomp suggests that it is not being used.

When I run setxkbmap -option "grp:toggle", everything then works (even though this should be redundant with the configuration).

  • 01_xorg.conf.d is my Xorg configuration: everything in /etc/X11/xorg.conf.d. I do not have an /etc/X11/xorg.conf, and my only vendor configurations in /usr/share/X11/xorg.conf.d/ are for associating input devices with libinput (and enabling quirks for certain ones).
  • 02_Xorg.0.log is my Xorg log when booting with this configuration. You can see that the dvp layout is recognized.
  • 03xkb_BEFORE_setxkbmap.xkb is the generated source for this configuration, obtained using xkbcomp $DISPLAY 1.xkb.
  • [`04_xkb_AFTER_setxk
@CodingKoopa
CodingKoopa / setup-llvm
Created October 30, 2022 20:37
Setup LLVM
#!/bin/sh -eu
# See https://clang.llvm.org/get_started.html.
LLVM_VERSION=15.0.0
readonly LLVM_VERSION
source_dir=llvm-project-$LLVM_VERSION.src
source_archive=llvm-project-$LLVM_VERSION.src.tar.xz
source_url=https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$source_archive
@CodingKoopa
CodingKoopa / setup-llvm.sh
Last active October 30, 2022 20:36
Setup LLVM
#!/bin/sh -eu
# See https://clang.llvm.org/get_started.html.
LLVM_VERSION=15.0.0
readonly LLVM_VERSION
source_dir=llvm-project-$LLVM_VERSION.src
source_archive=llvm-project-$LLVM_VERSION.src.tar.xz
source_url=https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$source_archive
class EntityNotFound extends Error {
constructor(message) {
super(message);
this.name = "EntityNotFound";
}
}
function _getFolderByName(parent_folder, name) {
if (parent_folder === undefined || name === undefined) {
throw new Error(`Did you accidentally run this function directly?`);
@CodingKoopa
CodingKoopa / driveHelper.gs
Created August 18, 2022 02:39
something google script
// Entrypoint function.
function driveHelper() {
// Get a collection of all files in the user drive.
const files = DriveApp.getFiles();
// For each file.
while (files.hasNext()) {
// Get the file.
const file = files.next();
// Fix restricted characters (https://rclone.org/local/#restricted-characters)