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
[Scheme]
Name=Everforest
ColorCursor=#7fbbb3
ColorForeground=#d8cacc
ColorBackground=#323d43
TabActivityColor=#88C0D0
ColorPalette=rgb(74,85,91);rgb(230,129,131);rgb(167,192,128);rgb(219,188,127);rgb(127,187,179);rgb(214,153,182);rgb(131,192,146);rgb(216,202,172);rgb(82,92,98);rgb(230,129,131);rgb(167,192,128);rgb(219,188,127);rgb(127,187,179);rgb(214,153,182);rgb(131,192,146);rgb(216,202,172)
ColorBold=#415c6d
ColorBoldUseDefault=FALSE
@thugcee
thugcee / tmux-switch-pane.sh
Created January 11, 2021 22:56
tmux and fzf: fuzzy tmux session/window/pane switcher (this version uses tmux new popup window)
#!/bin/bash
# customizable
LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}"
FZF_COMMAND="fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2"
# do not change
TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:"
# select pane
@habdenscrimen
habdenscrimen / obsidian.css
Last active January 29, 2024 22:29
Set custom font sizes for Obsidian default theme
:root
{
--font-size-normal: 19px;
--font-size-code: 15px;
--font-size-side-dock: 15px;
--font-size-side-dock-title: 18px;
--font-size-status-bar: 12px;
--font-size-h1: 38px;
--font-size-h2: 30px;
--font-size-h3: 24px;
@miguelgrinberg
miguelgrinberg / .tmux.conf
Last active March 15, 2022 11:39
My .tmux.conf file for working with tmux
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
@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 = ''

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

@gistub
gistub / unix_socket_datagram_stream_rust.md
Last active November 17, 2023 20:52
[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

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

@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'
@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'