Skip to content

Instantly share code, notes, and snippets.

@ksqsf
ksqsf / sigsegv.rs
Last active March 15, 2023 03:55
Catch SIGSEGV in Rust
#![feature(libc)]
extern crate libc;
use libc::*;
use std::panic::*;
use std::ptr::*;
fn main() {
unsafe {

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@mishurov
mishurov / syntax.s
Last active July 18, 2024 16:06
AT&T assembly syntax and IA-32 instructions
# --------
# Hardware
# --------
# Opcode - operational code
# Assebly mnemonic - abbreviation for an operation
# Instruction Code Format (IA-32)
# - Optional instruction prefix
# - Operational code
@vaiorabbit
vaiorabbit / fnv32a.el
Last active October 8, 2023 03:50
FNV-1a Hash (http://isthe.com/chongo/tech/comp/fnv/) in Emacs Lisp.
(defun fnv32a (s)
"Calculates FNV-1a 32-bit hash of given string s."
(let (hval)
(setq hval 2166136261) ; hval = FNV1_32A_INIT
(loop for c across s do
(setq hval (logxor hval c)) ; hval ^= c
(setq hval (* 16777619 hval)) ; hval *= FNV_32_PRIME
(setq hval (mod hval 4294967296))) ; hval %= UINT32_MAX
hval))
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fredrick
fredrick / screen.md
Created September 14, 2011 15:30
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow