Skip to content

Instantly share code, notes, and snippets.

View rmsiface.txt
RMS NOTATION TUTORIAL
BEHAVIOR
=: write-only
+: read/writeable
&: earlyclobber (impacts register sharing, defensive copying, etc.)
%: commutative
,: groups alternative constraints
?: discourages group of constraints
@jart
jart / illumination.sh
Last active Apr 16, 2020
Rational Illumination for PC and TV w/ IBM Scratchpad
View illumination.sh
#!/bin/sh
fricas -nosman <<EOF
E := [_
-- Standard Illumination Model for Computers_
--_
-- Is defined as a system of linear equations, where negative_
-- colors don't exist and is solved by computing the point at_
-- which they all intersect the one which needs to be defined_
-- as the Planckian locus of the illuminant._
@jart
jart / defer.c
Last active Apr 15, 2020
Go-like defer for C that works with most optimization flag combinations under GCC/Clang
View defer.c
#include "gc.h"
static bool PointerNotOwnedByParentStackFrame(struct StackFrame *frame,
struct StackFrame *parent,
void *ptr) {
return !(((intptr_t)ptr > (intptr_t)frame) &&
((intptr_t)ptr < (intptr_t)parent));
}
/**
View printimage.c
/*bin/echo ' -*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;coding:utf-8 -*-┤
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ To the extent possible under law, Justine Tunney has waived │
│ all copyright and related or neighboring rights to this file, │
│ as it is written in the following disclaimers: │
│ • http://unlicense.org/ │
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
╚────────────────────────────────────────────────────────────────────'>/dev/null
if ! [ "${0%.*}.exe" -nt "$0" ]; then
@jart
jart / isort.c
Last active May 27, 2020
Simple macro that makes djbsort (crypto submission reference impl version) 40% faster and 10% smaller
View isort.c
/*bin/echo '───────────────────────────────────────────────────────╗
│ To the extent possible under law, Justine Tunney has waived │
│ all copyright and related or neighboring rights to this file, │
│ as it is written in the following disclaimers: │
│ • http://unlicense.org/ │
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
╚────────────────────────────────────────────────────────'>/dev/null
CC=${CC:-cc}
CFLAGS=${CFLAGS:--g -Wall -Werror -Os -fno-pie -march=native}
$CC $CFLAGS -o isort.o -c isort.c &&
View proxy.py
#!/usr/bin/env python2
import BaseHTTPServer
import SocketServer
import base64
import httplib
import mimetypes
import os
import shutil
import ssl
@jart
jart / fone.go
Last active Jun 6, 2020
Linux CLI Telephone in 300 lines of Go. This is a NAT traversing SIP user agent. It can hook into the PSTN via gateways like Flowroute. The keyboard can be used to send DTMF tones.
View fone.go
// To the extent possible under law, Justine Tunney has waived
// all copyright and related or neighboring rights to this file,
// as it is written in the following disclaimers:
// - http://unlicense.org/
// - http://creativecommons.org/publicdomain/zero/1.0/
package main
// #cgo pkg-config: ncurses libpulse-simple
// #include <stdlib.h>
View NonBlockingThreadPool.diff
--- /tmp/NonBlockingThreadPool.h 2018-05-25 12:50:34.146863121 -0700
+++ NonBlockingThreadPool.h 2018-05-25 12:48:54.000000000 -0700
@@ -10,6 +10,7 @@
#ifndef EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
#define EIGEN_CXX11_THREADPOOL_NONBLOCKING_THREAD_POOL_H
+#include <iostream>
namespace Eigen {
View mkcc.sh
#!/bin/sh
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
View microarchitectures.txt
# Noteworthy CPU Features
SSE 128-bit vector instructions (e.g. addps http://www.felixcloutier.com/x86/ADDPS.html)
SSE4.1 Makes SSE good
SSE4.2 Makes SSE do strings and CRC32
AVX Makes SSE 256-bit (e.g. vaddps)
AVX2 Adds features to AVX
AVX-512 Makes SSE 512-bit
SHA Makes SSE do SHA1 and SHA256
FMA Fused multiply–add
CLMUL Carry-less multiplication https://goo.gl/ritKJX
You can’t perform that action at this time.