Skip to content

Instantly share code, notes, and snippets.

View mohamed's full-sized avatar

Mohamed A. Bamakhrama mohamed

View GitHub Profile
@hyperupcall
hyperupcall / settings.jsonc
Last active December 9, 2025 18:42
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
module corescore_emitter_uart
#(
parameter clk_freq_hz = 0,
parameter baud_rate = 57600)
(
input wire i_clk,
input wire i_rst,
input wire [7:0] i_data,
input wire i_valid,
output reg o_ready,
@jakelevi1996
jakelevi1996 / .Finding eigenvalues using simultaneous iteration.md
Last active October 11, 2025 21:55
Finding eigenvalues using simultaneous iteration

Finding eigenvalues using simultaneous iteration

This Gist describes simultaneous iteration, an eigenvalue algorithm for a symmetric NxN matrix A, which can be seen as a continuation of my previous Gist on a conceptually straightforward (albeit practically sub-optimal) eigenvalue algorithm for a symmetric NxN matrix. The algorithm presented here is more practically useful than the one presented in the previous Gist, although still not as practically useful as the implicit QR algorithm.

We want to find the eigenvalue decomposition for the symmetric matrix A; that is, we want to find matrices U and D which satisfy A == U * D * U^T , where U is orthogonal (IE U * U^T equals the identity matrix) and D is diagonal.

Using the power method, we can take an initial guess of an eigenvector u, and repeatedly replace u with the matrix-vector product `A *

@cb372
cb372 / riscv.md
Last active August 3, 2025 22:04
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active December 3, 2025 17:13
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th