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
pub const std = @import("std"); | |
pub const dvui = @import("dvui"); | |
const Backend = dvui.backend; | |
pub const tardy = @import("tardy"); | |
const Tardy = tardy.Tardy(.io_uring); | |
const Runtime = tardy.Runtime; | |
const Socket = tardy.Socket; | |
const Timer = tardy.Timer; |
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
const std = @import("std"); | |
const pnmdec = @import("pnmdec.zig"); | |
pub fn quantFloydSteinberg( | |
rows: usize, | |
cols: usize, | |
out: [*]u1, | |
in: [*]u8, | |
) void { | |
for (0..rows) |row_cursor| { |
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
// SPDX-License-Identifier: MPL-2.0 | |
fn unescapeSlicePythonRepr( | |
out: []u8, | |
in: []const u8, | |
/// Never do output bound checks. Unsafe, use this if and only if | |
/// you know the string will fit (length at least input length - | |
/// 2) | |
comptime skip_bounds_check: bool, | |
) !usize { |
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
const std = @import("std"); | |
pub const IndexingPoolOptions = struct { | |
/// The maximum number of items the pool can hold. | |
max_items: usize = std.math.maxInt(u32), | |
/// The number of item indices to be kept for re-use. If this is | |
/// too low, items will leak until the pool is deinitialized. | |
free_list_len: usize = 64, | |
log: type = std.log.scoped(.indexing_pool), | |
}; |
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
#! /usr/bin/env python3 | |
import sys | |
import renderdoc as rd | |
actions = {} | |
def iterDraw(d, indent = ''): | |
global actions |
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
const std = @import("std"); | |
pub fn put(b: []u8, a: []const u8) usize { | |
@memcpy(b[0..a.len], a); | |
return a.len; | |
} | |
pub fn main() u8 { | |
var ally = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
defer ally.deinit(); |
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
const std = @import("std"); | |
const assert = std.debug.assert; | |
const Log2Int = std.math.Log2Int; | |
comptime { | |
std.testing.refAllDeclsRecursive(@This()); | |
} | |
const Register = extern union { | |
signed: i32, |
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
(defvar | |
python-on-region-template | |
"#! /usr/bin/env python3\nimport sys\nfor line in sys.stdin:\n sys.stdout.write(line$$)\n" | |
"The template to use for python-on-region. $$ indicates the point.") | |
(defun python-on-region--run () | |
(interactive) | |
(save-buffer) | |
(delete-window) | |
(switch-to-buffer python-on-region--buffer) |
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
function memfrob(str) { | |
var out = ""; | |
for (var i = 0; i < str.length; i++) { | |
out += String.fromCharCode(str.charCodeAt(i) ^ 42); | |
} | |
return out; | |
} | |
function apply(id, frobbed) { | |
document.getElementById(id).href = memfrob(atob(frobbed)); |
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
struct random_bit_generator { | |
uint32_t word; | |
uint8_t bits_remaining; | |
}; | |
static bool next_bit(struct random_bit_generator *rbg) { | |
if (rbg->bits_remaining == 0) { | |
rbg->word = arc4random(); | |
rbg->bits_remaining = 32; | |
} |
NewerOlder