This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
// ---------- Dynarray ------------------------------------------------------------------------------------------------ | |
#define x_DEF_DYNARRAY_SHARED(Name, V, Capacity) \ | |
internal V Name##_pop(Name* arr) { \ | |
if (arr->count_ == 0) PANIC("Can't pop empty dynarray"); \ | |
return arr->data[--arr->count_]; \ | |
} \ | |
\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: https://github.com/rygorous/gaffer_net/blob/master/main.cpp | |
const PROBABILITY_BITS: u32 = 15; | |
pub const PROBABILITY_MAX: u32 = 1 << PROBABILITY_BITS; | |
struct BinaryArithCoder { | |
lo: u32, | |
hi: u32, | |
bytes: Vec<u8>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import socketserver | |
import http.server | |
PORT = 8080 | |
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | |
def end_headers(self): | |
self.send_my_headers() | |
http.server.SimpleHTTPRequestHandler.end_headers(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import subprocess | |
import time | |
import re | |
code_windows = subprocess.check_output("wmctrl -lx | grep 'code.Code' | cut -f1 -d' '", shell=True).decode('utf-8').strip().split('\n') | |
for i in range(len(code_windows)): | |
subprocess.Popen([ "display", '-crop', '10,10,100,100', PAPER_PATH ]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const testPng = fs.readFileSync('input.png'); | |
// ===== crc-32 ============================================== | |
// https://github.com/SheetJS/js-crc32/blob/master/crc32.js | |
function signed_crc_table() { | |
var c = 0, table = new Array(256); | |
for(var n =0; n != 256; ++n){ | |
c = n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/bin/google-chrome-stable --enable-features=WebUIDarkMode --force-dark-mode %U |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _mainCRTStartup | |
extern _ExitProcess@4 | |
extern _MessageBoxA@16 ; Value after @ is size of args on stack | |
section .text | |
_mainCRTStartup: | |
; Setup stack to give us 4 bytes to play with | |
; push ebp | |
; sub esp, 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;================================================================================================== | |
; Ultra-small EXE layout forked from KeyJ's console clipboard app | |
; https://keyj.emphy.de/win32-pe/ | |
; | |
; Assembled with yasm 1.3.0 for Win64 | |
; https://yasm.tortall.net/Download.html | |
; | |
; .\yasm-1.3.0-win64.exe -fbin -o"out.exe" source.asm | |
; | |
bits 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WEBGL_NAMES = ["ACTIVE_ATTRIBUTES","ACTIVE_TEXTURE","ACTIVE_UNIFORMS","ALIASED_LINE_WIDTH_RANGE","ALIASED_POINT_SIZE_RANGE","ALPHA","ALPHA_BITS","ALWAYS","ARRAY_BUFFER","ARRAY_BUFFER_BINDING","ATTACHED_SHADERS","BACK","BLEND","BLEND_COLOR","BLEND_DST_ALPHA","BLEND_DST_RGB","BLEND_EQUATION","BLEND_EQUATION_ALPHA","BLEND_EQUATION_RGB","BLEND_SRC_ALPHA","BLEND_SRC_RGB","BLUE_BITS","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","BROWSER_DEFAULT_WEBGL","BUFFER_SIZE","BUFFER_USAGE","BYTE","CCW","CLAMP_TO_EDGE","COLOR_ATTACHMENT0","COLOR_BUFFER_BIT","COLOR_CLEAR_VALUE","COLOR_WRITEMASK","COMPILE_STATUS","COMPRESSED_TEXTURE_FORMATS","CONSTANT_ALPHA","CONSTANT_COLOR","CONTEXT_LOST_WEBGL","CULL_FACE","CULL_FACE_MODE","CURRENT_PROGRAM","CURRENT_VERTEX_ATTRIB","CW","DECR","DECR_WRAP","DELETE_STATUS","DEPTH_ATTACHMENT","DEPTH_BITS","DEPTH_BUFFER_BIT","DEPTH_CLEAR_VALUE","DEPTH_COMPONENT","DEPTH_COMPONENT16","DEPTH_FUNC","DEPTH_RANGE","DEPTH_STENCIL","DEPTH_STENCIL_ATTACHMENT","DEPTH_TEST","DEPTH_WRITEMASK","DITHER","DON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <stddef.h> | |
#include <stdlib.h> | |
#define Vec( T ) struct { \ | |
size_t count; \ | |
T *items; \ | |
} |
NewerOlder