Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active April 25, 2024 01:18
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@davidad
davidad / asmrepl.lua
Created March 1, 2014 12:08
Abusing LuaJIT as a REPL for assembly language
-- warning: this is hacky. run at your own risk.
--
-- before you run this, put sum_list.asm in a dynamic library.
--
-- on OSX that means
-- $ nasm -f macho64 sum_list.asm
-- $ libtool -dynamic sum_list.o -o libsum_list.dylib
--
-- on Linux it means
-- $ nasm -f elf64 sum_list.asm
@fijimunkii
fijimunkii / gist:54089bce9af6a68fd75536496cba6030
Created April 16, 2016 14:34 — forked from andrewlkho/gist:7373190
How to use authentication subkeys in gpg for SSH public key authentication

GPG subkeys marked with the "authenticate" capability can be used for public key authentication with SSH. This is done using gpg-agent which, using the --enable-ssh-support option, can implement the agent protocol used by SSH.

Requirements

A working gpg2 setup is required. It may be possible to use gpg 1.4 but with gpg-agent compiled from gpg2. If you are using OS X 10.9 (Mavericks) then you may find the instructions [here][1] useful.

@johnny13
johnny13 / dircolors
Last active September 8, 2021 19:32
my dark background friendly dir colors
#############################################################################
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
#
# -------------- [ ATTRIBUTES ] --------------
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
pub trait IteratorExt: Iterator + Sized {
fn our_flatten(self) -> Flatten<Self>
where
Self::Item: IntoIterator;
}
impl<T> IteratorExt for T
where
T: Iterator,
{
fn our_flatten(self) -> Flatten<Self>
@bjesus
bjesus / README.md
Last active February 9, 2024 12:46
Weather widget for waybar
@sogaiu
sogaiu / tree-sitter-api-notes.md
Last active November 10, 2020 11:31
tree-sitter query api notes
  • current docs
    • query consists of one or more patterns
    • each pattern is an s-expression that matches nodes in a tree
    • expression consists of pair of parens containing:
      • node's type
      • optionally series of other s-expressions matching node's children
    • prefix a child pattern with a field name followed by a colon
    • match anonymous nodes by expressing name between double quotes
    • captures enable association of names with specific nodes in a pattern
  • capture names are written after the nodes they refer to
@ugursogukpinar
ugursogukpinar / sway-config
Last active March 13, 2024 15:11
wf-recorder for swaywm
set $screenrecorder `bash $HOME/scripts/toggle-screen-recorder.sh`
bindsym --to-code $mod+Shift+R exec $screenrecorder
@sogaiu
sogaiu / tree-sitter-glossary.md
Last active July 13, 2021 03:45
tree-sitter term glossary draft
@stong
stong / CleanBoot.java
Last active January 27, 2024 11:35
Real World CTF 2023: Dark Portal Writeup
package org.mapleir;
import org.mapleir.app.client.SimpleApplicationContext;
import org.mapleir.app.service.ApplicationClassSource;
import org.mapleir.app.service.InstalledRuntimeClassSource;
import org.mapleir.asm.ClassHelper;
import org.mapleir.asm.ClassNode;
import org.mapleir.asm.MethodNode;
import org.mapleir.context.AnalysisContext;
import org.mapleir.context.BasicAnalysisContext;