These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.
Modern operating systems, booted inside Real
mode,
-- Load foreign-function-interface handle | |
local ffi = require("ffi") | |
-- Shortcut FFI C namespace | |
local C = ffi.C | |
-- Load Windows kernel32 DLL | |
local kernel32 = ffi.load("kernel32") | |
-- Add C definitions to FFI for usage descriptions of components | |
ffi.cdef([[ | |
// Redefinitions for WinAPI conventions | |
typedef void VOID; |
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 |
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
struct foo {
struct bar {
int x;
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
import numpy as np | |
from numpy import pi | |
# import matplotlib.pyplot as plt | |
N = 400 | |
theta = np.sqrt(np.random.rand(N))*2*pi # np.linspace(0,2*pi,100) | |
r_a = 2*theta + pi | |
data_a = np.array([np.cos(theta)*r_a, np.sin(theta)*r_a]).T | |
x_a = data_a + np.random.randn(N,2) |
import os | |
import argparse | |
import hashlib | |
import hf_transfer # py -m pip install hf-transfer | |
CHUNK_SIZE = 10_485_760 | |
parser = argparse.ArgumentParser(description='HuggingFace fast model downloader') | |
parser.add_argument('--url', type=str, help='file url') | |
args = parser.parse_args() |
sentry
SENTRY_SECRET_KEY
to random 32 char stringdocker-compose up -d
docker-compose exec sentry sentry upgrade
to setup database and create admin userdocker-compose exec sentry pip install sentry-slack
if you want slack plugin, it can be done laterdocker-compose restart sentry
9000
#netcat proxy to a different backed and serve requests on port80 | |
mkfifo fifo_pipe | |
nc -lk -p 80 < fifo_pipe | nc 192.168.1.10 3306 >fifo_pipe | |
#socat doing the same with connection verbosity | |
socat -d -d TCP-LISTEN:80,fork TCP:192.168.1.10:3306 |