This file contains hidden or 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
from math import pow | |
def linear_to_srgb(c): | |
if c < 0.0031308: | |
return 12.92 * c | |
return 1.055 * pow(c, 0.41666) - 0.055 | |
def srgb_to_linear(c): | |
if c < 0.04045: | |
return c / 12.92 |
This file contains hidden or 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
CC ?= cc | |
CFLAGS ?= -Wall -Wextra -std=c11 -O3 | |
BINDIR = bin | |
OUTNAME = lz | |
SOURCES = lz.c | |
OBJECTS = $(SOURCES:%.c=$(BINDIR)/%.o) | |
export V := false | |
export CMD_PREFIX := @ |
This file contains hidden or 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
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <mach/mach.h> | |
#include <mach/vm_statistics.h> | |
void vm_stat() | |
{ | |
int host = mach_host_self(); | |
vm_statistics64_data_t stat; | |
mach_msg_type_number_t count; |
This file contains hidden or 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
// clang mouse-click.c -o mouse-click -framework ApplicationServices | |
#include <ApplicationServices/ApplicationServices.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 3) | |
{ | |
fprintf(stderr, "usage: %s [seconds to wait] [number of clicks]\n", argv[0]); |
This file contains hidden or 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
constexpr unsigned int CRC32_TABLE[] = { | |
0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC, 0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C, | |
0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C, 0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C | |
}; | |
constexpr unsigned int crc32_4(char c, unsigned int h) { return (h >> 4) ^ CRC32_TABLE[(h & 0xF) ^ c]; } | |
constexpr unsigned int crc32(const char *s, unsigned int h = ~0) { return !*s ? ~h : crc32(s + 1, crc32_4(*s >> 4, crc32_4(*s & 0xF, h))); } | |
constexpr unsigned int djb2a(const char *s, unsigned int h = 5381) { return !*s ? h : djb2a(s + 1, 33 * h ^ *s); } | |
constexpr unsigned int fnv1a(const char *s, unsigned int h = 0x811c9dc5) { return !*s ? h : fnv1a(s + 1, (h ^ *s) * 0x01000193); } |
This file contains hidden or 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
execute pathogen#infect() | |
filetype plugin indent on | |
syntax on | |
set nocp | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set smartindent | |
set cinoptions=:0,l1,g0,N-s,(0 |
NewerOlder