Skip to content

Instantly share code, notes, and snippets.

@HerringtonDarkholme
HerringtonDarkholme / nihongo.cpp
Last active April 25, 2024 10:33
g++ nihongo.cpp
#define エスティーディー std
#define アイオーストリーム <iostream>
#define ユージング using
#define イフ if
#define インクルード #include
#define イント int
#define シーアウト cout
#define シーイン cin
#define ネームスペース namespace
#define ブール bool
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@eenblam
eenblam / linux_reading_list.md
Last active April 25, 2024 10:25
Linux Networking Reading List

Linux Networking Reading List

Currently in no particular order. Most of these are kind of ancient.

Where's all the modern documentation? So much of what I've turned up searching is other folks complaining about having few options beyond reading source code.

The OREILLY books, while dated, seem to be some of the best available. Note that these can be read with a 7-day trial. Do this! At least get through the introduction section and first chapter of each to see if it's what you're after.

https://www.netfilter.org/

@mdonkers
mdonkers / server.py
Last active April 25, 2024 10:25
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@alexpreynolds
alexpreynolds / pandas_df_to_tabix_via_libraries.py
Last active April 25, 2024 10:26
Create an indexed tabix file from a Pandas dataframe via "pure" Python
#!/usr/bin/env python
'''
Create an indexed tabix file from a Pandas dataframe
via "pure" Python (i.e., no subprocess)
'''
import os
import io
import pandas as pd
@jasonbekolay
jasonbekolay / trigger webViewWebContentProcessDidTerminate in simulator
Last active April 25, 2024 10:24
Killing a WKWebView content process in the iOS simulator to trigger a webViewWebContentProcessDidTerminate call
# In the command line, find the PID of your simulator process:
ps -p `pgrep launchd_sim`
# or if you have many simulators running:
ps -A | grep launchd_sim
# Find the PID of the WebContent process:
pgrep -P <simulator-pid> 'com.apple.WebKit.WebContent'
# kill it
@willprice
willprice / KINETICS_LABELS.md
Last active April 25, 2024 10:24
Kinetics Dataset Labels (name to ID)

Kinetics Numeric/String labels

These are mapping files that go between class IDs to class names. These are generated from the training CSV files from each dataset by collecting the unique classes, sorting them, and then numbering them from 0 upwards.

@endrsmar
endrsmar / index.ts
Created January 9, 2024 12:11
Raydium new pool listener
import { LiquidityPoolKeysV4, MARKET_STATE_LAYOUT_V3, Market, TOKEN_PROGRAM_ID } from "@raydium-io/raydium-sdk";
import { Connection, Logs, ParsedInnerInstruction, ParsedInstruction, ParsedTransactionWithMeta, PartiallyDecodedInstruction, PublicKey } from "@solana/web3.js";
const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com';
const RAYDIUM_POOL_V4_PROGRAM_ID = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8';
const SERUM_OPENBOOK_PROGRAM_ID = 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
const SOL_DECIMALS = 9;
const connection = new Connection(RPC_ENDPOINT);
@ityonemo
ityonemo / test.md
Last active April 25, 2024 10:23
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)