Skip to content

Instantly share code, notes, and snippets.

Avatar
🌻
if you know, you know

Meghan nektro

🌻
if you know, you know
View GitHub Profile
@nektro
nektro / asm.s
Last active Oct 28, 2022
32bit x86 Linux hello world exploration
View asm.s
.text
.intel_syntax noprefix
.file "test"
.globl _start
.type _start,@function
_start:
push ebp
push ebx
push edi
push esi
View dbg.zig
const std = @import("std");
const builtin = @import("builtin");
pub fn main() !void {
try dbg("{d}", 24);
}
fn dbg(comptime fmt: []const u8, x: anytype) !void {
comptime std.debug.assert(builtin.mode == .Debug);
View stackoverflow.zig
const std = @import("std");
extern fn sigaltstack(ss: *const stack_t, oss: *stack_t) c_int;
const stack_t = extern struct {
sp: ?*anyopaque,
flags: c_int,
size: usize,
};
View user_pass_ssh.go
package main
import (
"bytes"
"fmt"
"golang.org/x/crypto/ssh"
)
func main() {
View _more_readers.zig
pub usingnamespace @import("counting.zig");
View PanicAllocator.zig
const std = @import("std");
const Allocator = std.mem.Allocator;
pub const panic_allocator = Allocator{
.ptr = undefined,
.vtable = &panic_allocator_vtable,
};
const panic_allocator_vtable = Allocator.VTable{
.alloc = panicAlloc,
@nektro
nektro / main.zig
Created Apr 26, 2022
x11 opengl demo
View main.zig
const std = @import("std");
const c = @cImport({
@cInclude("X11/Xlib.h");
@cInclude("X11/Xutil.h");
@cInclude("X11/keysymdef.h");
@cInclude("GL/gl.h");
@cInclude("GL/glx.h");
});
View mime.zig
const std = @import("std");
const string = []const u8;
const types = std.ComptimeStringMap(string, .{
.{ ".aac", "audio/aac" },
.{ ".abw", "application/x-abiword" },
.{ ".arc", "application/x-freearc" },
.{ ".avi", "video/x-msvideo" },
.{ ".azw", "application/vnd.amazon.ebook" },
.{ ".bin", "application/octet-stream" },
View signal.zig
const std = @import("std");
const __sighandler_t = ?fn (c_int) callconv(.C) void;
extern fn signal(__sig: c_int, __handler: __sighandler_t) __sighandler_t;
pub fn listenFor(sig: c_int, comptime f: fn () void) void {
_ = signal(sig, Handler(f).handle);
}
fn Handler(comptime f: fn () void) type {
View docker.zig
const extras = @import("extras");
pub fn amInside() !bool {
return try extras.doesFileExist(null, "/.dockerenv");
}