Instantly share code, notes, and snippets.

View vulkan-cmake.cmake
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(EXAMPLEVULKAN C)
find_package(Vulkan REQUIRED)
add_subdirectory(deps)
add_subdirectory(lib)
add_executable(${PROJECT_NAME} src/main.c)
View MockServer.java
mockServer.when(
HttpRequest.request()
.withMethod("POST")
.withPath("/something")
).respond(
HttpResponse.response()
.withStatusCode(200)
.withHeader(Header.header(HttpHeaders.CONTENT_TYPE, "application/json"))
.withBody("{\"data\":{\"id\": \"" + id + "\"}")
View xorshiftrng128.c
#include <stdint.h>
uint64_t s[2];
uint64_t
xorshiftrng128(void)
{
uint64_t s1 = s[0];
uint64_t s0 = s[1];
uint64_t result = s0 + s1;
View Dockerfile
FROM ruby:2.5
ENV PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
sqlite3 \
nodejs \
ca-certificates \
libsqlite3-dev \
View mounting-bin-cue.md

I do know that it’s really easy to convert them into an ISO file, and then mount the ISO in debian based linux.

sudo apt-get install bchunk

The syntax from bchunk is as follows:

bchunk [-v] [-p] [-r] [-w] [-s]
View GeodesicSphere.js
/**
* @author Inscrutabilis / mailto:iinscrutabilis@gmail.com
*/
/*
* Generates a geodesic sphere geometry
* By default, it is 1x1x1 octahedron, as a first approximation to sphere
* It will return more sphere-like object if you specify iterations > 0
* But please keep in mind that it generates (4 ^ iterations) * 8 faces
* Radius argument overrides default sphere radius (1)
View sprite.frag
#version 330 core
in vec2 v_texcoord;
in vec4 v_color;
uniform sampler2D u_tex;
uniform mat4 u_combined;
out vec4 f_color;
View stopwatch.rb
#
# A simple stop watch for a quick timer to check app performance
#
# @see https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/
#
# @example Basic Usage
# timer = Stopwatch.new
# timer.start #=> 59539.814152996
# timer.stop #=> 59544.700881683
# timer.elapsed #=> 4.886728687000868
View pgcat.c
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <arpa/inet.h>
typedef struct buffer
{
uint32_t length;
uint32_t capacity;
View mach_gettime.c
#include "mach_gettime.h"
#include <mach/mach_time.h>
#define MT_NANO (+1.0E-9)
#define MT_GIGA UINT64_C(1000000000)
// TODO create a list of timers,
static double mt_timebase = 0.0;
static uint64_t mt_timestart = 0;