Skip to content

Instantly share code, notes, and snippets.

View nektro's full-sized avatar
🌻
if you know, you know

Meghan Denny nektro

🌻
if you know, you know
View GitHub Profile
View win32_error.zig
pub const ErrorCode = enum(u16) {
/// The operation completed successfully.
ERROR_SUCCESS = 0x00000000,
/// Incorrect function.
ERROR_INVALID_FUNCTION = 0x00000001,
/// The system cannot find the file specified.
ERROR_FILE_NOT_FOUND = 0x00000002,
View git-commit2pr.sh
git-commit2pr() {
patchid=$((1 + $RANDOM % 1000))
current=$(git branch --show-current)
newone="nektro-patch-${patchid}"
patchfile=$(git format-patch HEAD~1)
git reset --merge HEAD~1
git checkout -q origin/main
git checkout -b ${newone}
git am --reject ${patchfile}
git checkout ${current}
View build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = .{ .path = "main.zig" },
.target = target,
View 01.diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 925fd2d63..ff5005494 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -655,13 +655,13 @@ include_directories(
)
if(MSVC)
- set(EXE_CXX_FLAGS "/std:c++14")
+ set(EXE_CXX_FLAGS "/std:c++17")
@nektro
nektro / asm.s
Last active October 28, 2022 17:59
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() {
@nektro
nektro / main.zig
Created April 26, 2022 21:36
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");
});