Skip to content

Instantly share code, notes, and snippets.

@numberoverzero
numberoverzero / Preferences.sublime-settings
Last active January 31, 2016 08:01
sublime text user settings
{
"always_show_minimap_viewport": true,
"auto_complete_delay": 200,
"bold_folder_labels": true,
"caret_extra_width": 1,
"color_scheme": "Packages/Bubububububad and Boneyfied Color Schemes/Boneyfied.tmTheme",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
@numberoverzero
numberoverzero / gist:a2bb50011c64e20823c0
Last active February 15, 2016 23:43
Installed sublime packages
git
gitgutter
package control
sidebarenhancements
sublimelinter
sublimelinter-flake8
sublimelinter-jshint
theme - sodareloaded
sass
@numberoverzero
numberoverzero / CleanTwitchHomepage.user.js
Last active September 21, 2016 10:00
Clean up the twitch homepage to get to the shit I care about faster
// ==UserScript==
// @name CleanTwitchHomepage
// @namespace https://numberoverzero.com
// @description clean up the twitch homepage to get to the shit I care about
// @include http://www.twitch.tv/
// @include https://www.twitch.tv/
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 2
// @grant GM_addStyle
@numberoverzero
numberoverzero / Small timer.py
Last active December 20, 2016 19:47
Updated noop callback to correctly handle multiple args.
import time
def timer():
start = time.time()
return lambda: time.time() - start
def timed(callback=None):
if callback is None:
callback = lambda *a, **kw: None
def wrapper(func):
def wrapped_call(*args, **kwargs):
@numberoverzero
numberoverzero / pep487.py
Last active March 24, 2017 13:27
PEP 487 is insane, holy fuck this is awesome
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, TypeVar, Generic, Type
T = TypeVar("T")
class Field(Generic[T]):
key: str
t: Type[T]
readonly: bool
def __init__(self, t: Type[T], readonly: bool=True) -> None:
@numberoverzero
numberoverzero / compile_stockfish.sh
Created February 11, 2019 05:26
compile stockfish from github on RHEL into /opt/stockfish
#!/usr/bin/env bash
# assumes bmi2 arch: "x86 64-bit with pext support"
# compiled binary ends in /opt/stockfish/$MAJOR_VERSION/bin/stockfish
set -e
set -x
sudo yum update -y
sudo yum install -y git gcc gcc-c++
@numberoverzero
numberoverzero / 00_base.py
Last active July 26, 2019 17:23
support integral base string representations, especially for lexicographical sorting
def in_base(n: int, alphabet: str) -> str:
b = len(alphabet)
s = []
while n > 0:
d = n % b
s.append(alphabet[d])
n //= b
return "".join(reversed(s))
@dominikwilkowski
dominikwilkowski / README.md
Last active October 19, 2020 03:52
Ubuntu setup with NGINX http/2 and letsencrypt

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

@Chlumsky
Chlumsky / msdf-preview.shadron
Last active August 27, 2021 07:41
MSDF Preview
#include <math_constants>
#include <median>
#include <billboard>
#include <affine_transform>
glsl float linearStep(float a, float b, float x) {
return clamp((x-a)/(b-a), 0.0, 1.0);
}
@numberoverzero
numberoverzero / run_forked.rs
Created November 6, 2021 07:44
execute a function in a detached process and exit
// fork = "0.1"
use fork::{self, Fork};
use std::process;
/// no error handling, no logging, just one shot to run in a forked process
fn run_forked<R>(f: fn() -> R) -> bool
{
match fork::fork() {
Ok(Fork::Parent(_)) => {
// we're in the parent process, must have forked successfully