Skip to content

Instantly share code, notes, and snippets.

View danielsource's full-sized avatar
🪲
-Wall -Wextra -Wpedantic

Daniel de Lima Franceschetti danielsource

🪲
-Wall -Wextra -Wpedantic
View GitHub Profile
; How to compile this file:
; $ nasm -felf64 -o hello.o hello-linux64.asm
; $ ld -o hello.out hello.o
; $ ./hello.out
;
; Elements of a NASM program:
; * labels
; * instructions
; * operands
; * directives
@danielsource
danielsource / FooBar.c
Last active May 4, 2025 23:46
Random crappy code, please ignore.
#include <stdio.h>
int main(void) {
printf("hello, world!\n");
return 0;
}
/*
C operator precedence (RL is right-to-left associativity instead of LR)
+------------+---------------------------------------+
Some things that I did when half-reading https://blinry.org/tiny-linux/
Some other commands used:
git clone --depth=1 --branch=v6.12 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
make tinyconfig
make menuconfig
make -j4
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 96842ce81..8f0ab7094 100644
@danielsource
danielsource / windows7.sh
Created March 3, 2025 00:36
QEMU Windows 7 guest
#!/bin/sh
exec qemu-system-x86_64 \
-name "Windows 7" \
-enable-kvm \
-cpu host \
-smp 2 \
-m 1G \
-hda windows7.qcow2 \
-vga std \
-nic none `# disables network` \
@danielsource
danielsource / c_precedence.txt
Created March 3, 2025 00:28
C Operator Precedence
C operator precedence (RL is right-to-left associativity instead of LR)
+------------+---------------------------------------+
| precedence | operator |
+------------+---------------------------------------+
| 1 | x++ x-- x() x[] . -> (type){list} |
| 2 (RL) | ++x --x +x -x ! ~ (type) *x &x sizeof |
| 3 | * / % |
| 4 | + - |
| 5 | << >> |
| 6 | < <= > >= |
@danielsource
danielsource / b.bat
Created December 23, 2024 20:44
win32_hello
:: Build script.
@echo off
setlocal
set VSLANG=1033
set flags=/nologo /std:c++14 /Zi /W4 /wd4100
if not exist win32_precomp.pch (
cl %flags% /Yc"win32_precomp.hpp" /c win32_precomp.cpp
;;
;; My old config for GNU Emacs
;; Newest: https://github.com/danielsource/dotfiles/blob/main/.emacs
;;
(if (fboundp 'menu-bar-mode)
(menu-bar-mode -1))
(if (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode)