Skip to content

Instantly share code, notes, and snippets.

@robert-saramet
robert-saramet / riscv_guide_1.md
Created July 19, 2025 10:11
Comprehensive Guide to 32-Bit RISC-V Assembly Programming (RV32I)

Comprehensive Guide to 32-Bit RISC-V Assembly Programming (RV32I)

This guide provides a thorough introduction to programming in 32-bit RISC-V assembly language, focusing on the RV32I base integer instruction set. It starts with content from this cheat sheet and expands it into a complete, structured reference. The guide is organized for easy navigation, with clear sections, tables for listings, explanations, examples, and notes. It draws from official specifications and tutorials to ensure accuracy and completeness. Beginners can follow sequentially, while experienced users can reference specific sections.

Key assumptions:

  • We use the GNU Assembler (GAS) syntax, common for RISC-V tools.
  • Examples assume a bare-metal or simple simulator environment (e.g., RARS, Spike, or QEMU).
  • RV32I is the base; extensions like M (multiply/divide) are noted but not required unless specified.
  • Code snippets are testable in simulators; error handling and overflows are ign
@flight505
flight505 / UV_Cheat_Sheet.md
Created December 14, 2024 21:45
Astral UV Cheat Sheet

UV Cheat Sheet incorporating the latest tips and tricks from the official UV documentation:

UV Cheat Sheet

Installation

Install UV using the official standalone installer:

macOS and Linux:

@robert-saramet
robert-saramet / string_vs_str.rs
Created April 10, 2023 10:48
Comparison between the String and str types in Rust, including example functions and the effects of how the parameters are passed. This is only my understanding as a beginner and I'm not sure everything is correct.
// Idiomatic
// Modifies string_var in place; doesn't return anything
// The original string_var remains valid
fn takes_string_ref_no_return(string_var: &mut String) {
string_var.push_str("world");
}
// Idiomatic
// Returns a new owned String
// The original str_var also remains valid
@swinzy
swinzy / ConfigHowdy.sh
Created November 9, 2022 14:23
Config Howdy for Fedora 36 using GNOME
# !/bin/bash
# Reference: https://copr.fedorainfracloud.org/coprs/principis/howdy/
# sudo required
if ! [ $(id -u) = 0 ]; then
echo "Root privilege is needed. Please rerun the script as root." >&2
exit 1
fi
SUDO_CFG="/etc/pam.d/sudo"
@Integralist
Integralist / Go vs Rust - syntax differences.md
Last active May 30, 2025 08:34
Go: syntax differences with Rust #go #rust

The following examples are written from the perspective of an engineer who writes code using the Go programming language, and so you'll find that I've written notes about how Rust is different and I don't really cover the why or how of the example Go code. Additionally, the Go examples are far from exhaustive because I'm using this as a 'scratch pad' for my Rust learnings.

Error Handling

Go example

@sr229
sr229 / .startEnv.vscode.sh
Created August 27, 2019 11:20
Silverblue delegate script for VSCode
#!/bin/sh
# Copyright 2019 (c) Ayane Satomi
# Public Domain
#
# Delegate Script for VSCode
# This makes sure VScode only runs in a Toolbox container.
# This only works with a default container.
FEDORA_DEFAULT_CONTAINER="fedora-toolbox-$(whoami)-30"

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

@fnky
fnky / ANSI.md
Last active December 12, 2025 15:18
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@rawnly
rawnly / excuses.txt
Created August 24, 2018 19:38
All (literally) 145 sentences from developerexcuses.com
It was working in my head
Even though it doesn't work, how does it feel?
Oh, you said you DIDN'T want that to happen?
THIS can't be the source of THAT
I thought he knew the context of what I was talking about
I can have a look but there's a lot of if statements in that code!
It works, but it's not been tested
The accounting department must have cancelled that subscription
The marketing department made us put that there
I couldn't find any examples of how that can be done anywhere else in the project

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment