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
#!/bin/bash | |
ROOT=$HOME/software | |
REPO_URL=https://ziglang.org/download/index.json | |
TMPDIR=/tmp/zig-update | |
REPO_ENTRY=x86_64-linux | |
function die() | |
{ |
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
/* Resource ID = 1 */ | |
TabLayout | |
{ | |
margins: 0; | |
DockLayout | |
{ | |
tab-title: "Menu"; | |
Button | |
{ | |
dock-site: bottom; |
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
#!/bin/bash | |
encodings="UTF-8 UTF-16LE UTF-16BE UTF-32LE UTF-32BE WINDOWS-1252 TCVN-5712 CP437 EBCDICATDE" | |
for enc in ${encodings,,}; do | |
echo -ne "20 text/plain charset=${enc}\r\n" > ${enc,,}.txt | |
echo -e "Serving content as ${enc}\n" | iconv -f "UTF-8" -t "${enc}" >> ${enc,,}.txt | |
iconv -f "UTF-8" -t "${enc}//TRANSLIT" ground-truth.txt >> ${enc,,}.txt | |
done |
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 <GL/glx.h> | |
#include <unistd.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <X11/X.h> | |
#include <X11/Xlib.h> | |
#include <dlfcn.h> | |
#include <signal.h> |
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 pkgs = struct { | |
const sdl2 = std.build.Pkg{ | |
.name = "sdl2", | |
.path = "./lib/SDL.zig/src/lib.zig", | |
}; | |
const zlm = std.build.Pkg{ | |
.name = "zlm", |
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 fn main() !void { | |
SysTick.init(1_000); | |
EventLoop.init(); | |
var serial_frame = async doSerialLoop(); | |
var blinky_frame = async doBlinkyLoop(); | |
EventLoop.run(); |
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"); | |
// debug switch to print all found anagrams | |
const print_all_results = false; | |
pub fn main() !void { | |
// arena for fast allocations | |
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
defer arena.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"); | |
// usage: | |
fn asyncMain() !void { | |
// Start two interleaving tasks | |
var task_a = async waitUntilAndPrint(start + 1000, start + 1200, "task a"); | |
var task_b = async waitUntilAndPrint(start + 500, start + 1300, "task b"); | |
var task_c = async waitUntilAndPrint(start + 800, start + 1100, "task c"); | |
await task_a; |
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 main() void { | |
std.log.info("mutable closure:",.{}); | |
runMutDemo(); | |
std.log.info("const closure:",.{}); | |
runConstDemo(); | |
} |
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 WriterSpec = struct { | |
pub const write = fn(self: *@This(), msg: []const u8) error{IoError}!void; | |
pub const flush = fn(self: @This()) void; | |
}; | |
const Writer = Interface(WriterSpec); |