Skip to content

Instantly share code, notes, and snippets.

View mtwilliams's full-sized avatar
👺
small engines & big data

Michael Williams mtwilliams

👺
small engines & big data
View GitHub Profile
@nneonneo
nneonneo / socks-proxy-simple.py
Created July 17, 2019 19:41 — forked from WangYihang/socks-proxy-simple.py
A simple socks server via python - updated for Pythonista (iOS)
#!python2
# -*- coding: utf-8 -*-
# 一个简单的 Socks5 代理服务器 , 只有 server 端 , 而且代码比较乱
# 不是很稳定 , 而且使用多线程并不是 select 模型
# Author : WangYihang <wangyihanger@gmail.com>
import socket
import threading
import sys
// --- Library --------------------------------------------------------------------------
#include <string.h>
#include <assert.h>
struct ui_box {int x,y,w,h;};
typedef unsigned long long ui_id;
struct ui_node {
int parent;
int lst, end, nxt;
int siz[2];
@niklas-ourmachinery
niklas-ourmachinery / reducing-build-times.md
Created January 24, 2019 16:30
Reducing build times by 20 % with a one line change

Reducing build times by 20 % with a one line change

Experimenting a bit with the /d2cgsummary and /d1reportTime flags described by Aras here and here I noticed that one of our functions was consistently showing up in the Anomalistic Compile Times section:

1>	Anomalistic Compile Times: 2
1>		create_truth_types: 0.643 sec, 2565 instrs
1>		draw_nodes: 0.180 sec, 5348 instrs
@pervognsen
pervognsen / rad.py
Last active January 18, 2024 02:30
# Reverse-mode automatic differentiation
import math
# d(-x) = -dx
def func_neg(x):
return -x, [-1]
# d(x + y) = dx + dy
def func_add(x, y):
@CodeMyUI
CodeMyUI / index.html
Created October 1, 2018 00:12
Sheen Hover
<canvas></canvas>
<button type="button">
<span>Hover Me</span>
</button>
@colmmacc
colmmacc / shardcalc.py
Last active August 7, 2023 11:05
Calculate the blast radius of a shuffle shard
import sys
# choose() is the same as computing the number of combinations. Normally this is
# equal to:
#
# factorial(N) / (factorial(m) * factorial(N - m))
#
# but this is very slow to run and requires a deep stack (without tail
# recursion).
#
struct path_iter {
const char *begin;
const char *end;
/* internal */
const char *next;
const char *eof;
};
static void
path_begin(struct path_iter *it, const char *str, const char *end)
{
@mmozeiko
mmozeiko / dwrite.cpp
Created July 25, 2018 17:36
DirectWrite without D2D
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <dwrite.h>
#include <intrin.h>
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "dwrite.lib")
#define CHECK(x) do { if (!(x)) __debugbreak(); } while (0)