Skip to content

Instantly share code, notes, and snippets.

@nsf
nsf / gist:eabc9018a4662c3f3ffc1a9209eacb6b
Last active May 19, 2019 07:16 — forked from williballenthin/gist:ee0335a6826ce55ece2d
Methods for fetching structure fields in Go (golang)
package main
import "log"
import "time"
import "reflect"
import "unsafe"
// suggested via http://stackoverflow.com/a/8363629/87207
func trace(s string) (string, time.Time) {
log.Println("START:", s)
@nsf
nsf / Vk.h
Created March 29, 2016 02:25
Vulkan C++ wrapper
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstring>
#include <vulkan/vulkan.h>
namespace vk {
template <typename EnumType, typename T = uint32_t>
@nsf
nsf / converters.go
Created March 6, 2016 00:23
VkCpp in Go
package main
import (
"fmt"
"strconv"
"strings"
)
type AnalyzedType struct {
Name string
#/!/bin/bash
set -e
export MYROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MY=$MYROOT/android
MYJAVADIR=$MY/src/com/nosmileface/vquest
MYNAME=VQuest
MYKEYSTORE=/home/nsf/tmp/AndroidKeys/my-developer-key.keystore
struct Quadric {
float q[10];
Quadric() = default;
Quadric(float q0, float q1, float q2, float q3, float q4,
float q5, float q6, float q7, float q8, float q9)
{
q[0] = q0;
q[1] = q1;
q[2] = q2;
q[3] = q3;
using NG.Coroutines;
using NG.Math;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
namespace NG.VoxelMap {
public static class Const {
using System;
using System.Linq;
using System.Collections.Generic;
namespace NG.Tasks {
public class Counter {
public int Count = 0;
/// Task that waits on this counter.
public Task WaitingTask;
@nsf
nsf / coroutines.nim
Last active December 13, 2019 14:55
Coroutines in nim
import queues
import locks
import macros
import sequtils
type
SchedulerCommandType = enum
scDone,
scYield,
scWaitForCoroutine,
@nsf
nsf / sxy.md
Last active November 22, 2015 00:44
Sxy

Sxy file format

The format is based on modern S-expression notation used widely today, for example in lisp family of programming languages. However the format is redefined from the ground up and is not compatible with any existing formats (unless unintentionally so).

Text encoding requirement

Format is defined in terms of ASCII byte values. Any ASCII-compatible encoding will work. The input is steam of values, not bytes, hence encodings like UTF-32 may work as well. Preferred encoding is UTF-8, but it's not required.

Lexical elements

@nsf
nsf / voxels.fs
Created September 13, 2015 08:43
namespace NG.FS.VoxelMap.Components
open System
open System.IO
open System.Diagnostics
open System.Collections.Generic
open NG.FS.VoxelMap.Common
open NG.FS.Math
open NG.FS.Coroutines
open NG.FS.ArrayUtils