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
/* make canon; ./canon | aplay -r 44100 -f U8 */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#define rs (1.0/44100.0) | |
#define fr(x) (440*pow(2,(x-57)*(1.0/12))) | |
#define s(x, n) sin((x=(x+fr(n)*rs))*6.2831853) | |
#define tf (((1.0/rs)*60.)*.25/160.0) | |
#define gv(c) (c-(c>'9'?('a'-10):'0')) | |
#define gct(i) (gv(ct[(i)*3]) << 8)+(gv(ct[(i)*3+1]) << 4)+(gv(ct[(i)*3+2])) |
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
# requires ffmpeg and curl | |
curl https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/864px-Tux.svg.png | ffmpeg -i - -c:v ppm -f image2 - | tail -c +17 | openssl enc -e -aes-256-ecb -K d38b38a2dd476e045c299e8ee5d6466834456d97bd592a71746b423a6a05f386 | head -c -16 | cat <(printf "P6\n864 1024\n255\n") - | ffmpeg -i - -c:v png -f image2 - | ffplay - |
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
#include "wtf.h" | |
MAINF | |
PRINT("Hello, world!") | |
ENDMAINF |
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
#include <stdint.h> | |
#include <immintrin.h> | |
#ifdef __GNUC__ | |
#define LOG2(X) \ | |
((uint32_t)(8 * sizeof(unsigned long long) - __builtin_clzll((X)) - 1)) | |
#else | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
inline uint32_t LOG2(uint64_t X) { |
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
#include <stdint.h> | |
#ifdef __GNUC__ | |
#define LOG2(X) \ | |
((uint32_t)(8 * sizeof(unsigned long long) - __builtin_clzll((X)) - 1)) | |
#else | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
inline uint32_t LOG2(uint64_t X) { | |
unsigned long out; |
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
function timingSafeEqual(a, b) { | |
if (a.length !== b.length) return false; | |
let result = 0; | |
for (let i = 0; i < a.length; i++) { | |
result |= a[i] ^ b[i]; | |
} | |
return result === 0; | |
} |
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
From c796842c4aaaca1b640a1fd0e03c9d8e85f571c8 Mon Sep 17 00:00:00 2001 | |
From: rfl890 <87506407+rfl890@users.noreply.github.com> | |
Date: Wed, 24 Jan 2024 18:14:16 -0500 | |
Subject: [PATCH] Update PRNG | |
--- | |
src/lib_math.c | 2 +- | |
src/lj_prng.c | 43 ++++++++++++++++++++++--------------------- | |
2 files changed, 23 insertions(+), 22 deletions(-) |
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
-- Change to the path of lua51.lib/libluajit-2.1.a/whatever LuaJIT library you link against | |
local lua_slib = "\"C:\\Users\\user\\bin\\luajit\\lib\\lua51.lib\"" | |
local CC = "clang -O2" | |
local stub_code = [[#include <lua.h> | |
#include <lauxlib.h> | |
#include <lualib.h> | |
#include <luajit.h> | |
#include <stdlib.h> |
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
local lib_color = {} | |
-- Constants | |
lib_color.color_type = { TYPE_8 = 39710315, TYPE_256 = 34942623, TYPE_RGB = 29505187 } | |
local FOREGROUND = 1 | |
local BACKGROUND = 2 | |
local ESCAPE = "\x1b[" | |
local RESET = "\x1b[0m" |
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
#include <stdio.h> | |
#include <stdint.h> | |
#include <Windows.h> | |
#include <bcrypt.h> | |
#include <ntstatus.h> | |
#include <ntdef.h> | |
typedef struct SHA256State { | |
BCRYPT_ALG_HANDLE algHandle; |
NewerOlder