Skip to content

Instantly share code, notes, and snippets.

Avatar

David Young-Chan Kay DavidYKay

View GitHub Profile
@DavidYKay
DavidYKay / peg_cpu.cpp
Last active Aug 13, 2022
Run an infinite loop at max/FIFO thread priority. OS: Linux, w/ pthread.
View peg_cpu.cpp
#include <pthread.h>
#include <sched.h>
#include <iostream>
void infLoop() {
int i = 0;
while (true) {
i = (i + 1) % 1024;
}
}
@DavidYKay
DavidYKay / Callstack
Last active Dec 3, 2019
OGRE 2.2: Callstack for HlmsComputeJob crash in Tutorial_OpenVR (8579b3508300ab3450c556c3aae0a5a22f95468e) - "Case 1"
View Callstack
#0 Ogre::HlmsCompute::findComputeJob (this=<optimized out>, datablockName=...) at /home/dk/workspace/current/mccarthy/subprojects/ogre2/OgreMain/src/OgreHlmsCompute.cpp:553
#1 0x00007ffff69a33da in Ogre::CompositorPassCompute::CompositorPassCompute (this=0x555556a02410, definition=0x5555567a2200, defaultCamera=0x5555568626c0, parentNode=0x5555569c02b0, rtv=<optimized out>) at /home/dk/workspace/current/mccarthy/subprojects/ogre2/OgreMain/src/Compositor/Pass/PassCompute/OgreCompositorPassCompute.cpp:112
#2 0x00007ffff69885f7 in Ogre::CompositorNode::createPasses (this=0x5555569c02b0) at /home/dk/workspace/current/mccarthy/subprojects/ogre2/OgreMain/src/Compositor/OgreCompositorNode.cpp:730
#3 0x00007ffff6994cb8 in Ogre::CompositorWorkspace::connectAllNodes (this=this@entry=0x5555569b2690) at /home/dk/workspace/current/mccarthy/subprojects/ogre2/OgreMain/src/Compositor/OgreCompositorWorkspace.cpp:344
#4 0x00007ffff69956b2 in Ogre::CompositorWorkspace::recreateAllNodes (this=this@entry=0x5555569b2690) at /h
@DavidYKay
DavidYKay / Ogre.log
Last active Dec 3, 2019
OGRE 2.2: Callstack for HlmsComputeJob crash in Tutorial_OpenVR (After passing in the Compute Shader) - "Case 3"
View Ogre.log
23:39:51: Creating resource group General
23:39:51: Creating resource group Internal
23:39:51: Creating resource group Autodetect
23:39:51: SceneManagerFactory for type 'DefaultSceneManager' registered.
23:39:51: Registering ResourceManager for type Material
23:39:51: Registering ResourceManager for type Mesh
23:39:51: Registering ResourceManager for type Mesh2
23:39:51: Registering ResourceManager for type OldSkeleton
23:39:51: MovableObjectFactory for type 'ParticleSystem' registered.
23:39:51: ArchiveFactory for archive type FileSystem registered.
@DavidYKay
DavidYKay / a.d
Created Oct 23, 2018
Simple example of loading/unloading DLLs in D. This could be extended to provide a hot-swapping mechanism.
View a.d
import core.stdc.stdio;
extern (C) int dll() {
printf("hello from dll A!\n");
return 0;
}
shared static this() {
printf("liba.so shared static this\n");
}
@DavidYKay
DavidYKay / HelloVr.kt
Last active Sep 22, 2018
Hello World using OpenVR and LWJGL in Kotlin. Ported from C++ example: https://gist.github.com/DavidYKay/b01fc8cf1bc682671e0ad6000b8e7c5a
View HelloVr.kt
import glm_.vec4.Vec4
import org.lwjgl.BufferUtils
import org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.glfw.GLFWErrorCallback
import org.lwjgl.glfw.GLFWKeyCallbackI
import org.lwjgl.glfw.GLFWVidMode
import org.lwjgl.opengl.GL14.GL_DEPTH_COMPONENT24
import org.lwjgl.opengl.GL30.*
import org.lwjgl.openvr.*
@DavidYKay
DavidYKay / HelloOpenVR_GLFW.cpp
Last active Sep 21, 2018 — forked from VirtuosoChris/HelloOpenVR_GLFW.cpp
Minimal OpenVR + GLFW Example
View HelloOpenVR_GLFW.cpp
/**** Minimal OpenVR example : outputs textures to the headset, a different color in each eye. No head tracking or input anywhere. Bare minimum. ****/
/// header only extension loader and object oriented bindings -- ref : https://github.com/VirtuosoChris/glhpp
#define GL_ALT_GL_API 1
#define GL_ALT_GLES_API 2
#include <glalt/gl4.5.h> // opengl api
#include <glalt/glext.h>
#include <opengl.hpp> // object oriented bindings
View HttpActor.cpp
# Web.py uses a different URL.
# Please go into HttpActor.cpp and change the designated URL, as follows:
Request->SetURL("http://localhost:8080/");
View Speech.md

Nick Wong: wedding toast

Introduction

I'm David Kay.
I'm Nick's first client in his new career as a coach. They say there's a sucker born every minute, and [pointing at self] now you know they're telling the truth! [Smile] What I'd like to do today is to take a moment to celebrate Dr. Nick Wong through the lens of a painful and candid story.

Beginning - Boy meets girl

Apple

When I met Nick, I was down on my luck.

@DavidYKay
DavidYKay / Speech.md
Created Jun 10, 2018
Nick Wong wedding speech
View Speech.md

Nick Wong: wedding toast

Introduction

I'm David Kay.
I'm Nick's first client in his new career as a coach. They say there's a sucker born every minute, and [pointing at self] now you know they're telling the truth! [Smile] What I'd like to do today is to take a moment to celebrate Dr. Nick Wong through the lens of a painful and candid story.

Beginning - Boy meets girl

Apple

When I met Nick, I was down on my luck.

@DavidYKay
DavidYKay / dev_server.nginx
Created Jun 25, 2017
Nginx local SSL reverse proxy - helpful for development when you need SSL in front of your dev server.
View dev_server.nginx
upstream backends {
server localhost:3000;
}
server {
listen 80;
listen 443 ssl;
server_name foo.bar;
ssl_certificate dev.crt;