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
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");
}
View cookies.zig
const std = @import("std");
const string = []const u8;
const http = @import("apple_pie");
pub const Jar = std.StringHashMap(string);
pub fn parse(alloc: std.mem.Allocator, headers: http.Request.Headers) !Jar {
var map = Jar.init(alloc);
// extra check caused by https://github.com/Luukdegram/apple_pie/issues/70
const h = headers.get("Cookie") orelse headers.get("cookie");
View UrlValues.zig
const UrlValues = @This();
const string = []const u8;
const std = @import("std");
const uri = @import("uri");
inner: std.StringArrayHashMap(string),
pub fn init(alloc: std.mem.Allocator) UrlValues {
return .{
.inner = std.StringArrayHashMap(string).init(alloc),
View yaml.zig
const std = @import("std");
const string = []const u8;
const extras = @import("extras");
const c = @cImport({
@cInclude("yaml.h");
});
//
//