Skip to content

Instantly share code, notes, and snippets.

View the-shank's full-sized avatar
💭
#rust #llvm

theshank the-shank

💭
#rust #llvm
View GitHub Profile
@bradtraversy
bradtraversy / myscript.sh
Last active May 16, 2025 08:30
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@lunks
lunks / gruvbox-dark.conf
Last active November 28, 2024 00:18
gruvbox-dark theme for kitty - the fast, featureful, GPU based terminal emulator
# gruvbox-dark colorscheme for kitty
# snazzy theme used as base
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
# black
@ibarchenkov
ibarchenkov / stream_data_ecto_factory.ex
Created January 31, 2019 21:09
Elixir Ecto testing factories combined with StreamData generators.
defmodule MyApp.Factory do
use ExUnitProperties
alias MyApp.{Repo, User, Comment}
### Generators
def generator(:user) do
gen all name <- string(:alphanumeric, min_length: 2),
email <- generator(:email),
age <- integer(10..130) do
@firat
firat / gist:864e21d8d0a64dcf62ca9ba107cc2b0f
Created June 18, 2019 05:34
gruvbox-dark-hard-256-alacritty
# Base16 Gruvbox dark, hard 256 - alacritty color config
# Dawid Kurek ([email protected]), morhetz (https://github.com/morhetz/gruvbox)
colors:
# Default colors
primary:
background: '0x1d2021'
foreground: '0xd5c4a1'
# Colors the cursor will use if `custom_cursor_colors` is true
cursor:
@mikeboiko
mikeboiko / tmux.conf
Last active March 23, 2024 07:32
Automatically update $DISPLAY for each tmux pane after attaching to session
set-hook -g client-attached 'run-shell /bin/update_display.sh'
@kamek-pf
kamek-pf / alacritty.yml
Last active February 21, 2024 12:20
Gruvbox Material Dark Medium - Alacritty
# Colors (Gruvbox Material Dark Medium)
colors:
primary:
background: '0x282828'
foreground: '0xdfbf8e'
normal:
black: '0x665c54'
red: '0xea6962'
green: '0xa9b665'

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

@gistub
gistub / unix_socket_datagram_stream_rust.md
Last active September 13, 2024 08:24
[Rust: Unix Domain Socket] bidirectional socket in #rust

To create a bidirectional unix IPC:

  1. Server creates a sockets and binds it to an address (typically a file). Do NOT use connect as all send/recv operation will be done using connect's address!
  2. Client creates a socket and binds it to its own address. However the socket connects to the address of server.
  3. Server uses recv_from to get data from socket along side with the address of the client that sent the data. This way it can use the address to send a response back to client.

Example in Rust

server.rs

Announcing cargo-udeps

One of the biggest issues that most people have with Rust are the long compile times. One of the reasons why compile times are so long is because many projects use quite a few dependencies from crates.io. Your dependencies have dependencies of their own, and they in turn have dependencies as well, and so on. This results in really big graphs of crates that all have to be compiled by cargo. Sometimes however, a crate actually doesn't use anything of some of its dependencies. Then those dependencies can be removed, resulting in faster builds for that crate. But how do you detect them? Often they sit in Cargo.toml for a long time until someone discovers they are actually unused and removes them (example). This is where cargo-udeps comes in. cargo-udeps is an automated tool to find dependencies that were specified in Cargo.toml but never used in the cra

@debashisdeb
debashisdeb / debug_stuff.py
Last active March 13, 2023 15:58 — forked from dhrrgn/debug_stuff.py
A handy SQL debug function for Flask-SQLAlchemy
from . import app
from flask.sqlalchemy import get_debug_queries
if app.debug:
app.after_request(sql_debug)
def sql_debug(response):
queries = list(get_debug_queries())
query_str = ''