Skip to content

Instantly share code, notes, and snippets.

View teknoman117's full-sized avatar

Nathan Lewis teknoman117

View GitHub Profile
@teknoman117
teknoman117 / 0_reuse_code.js
Created August 21, 2014 21:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@teknoman117
teknoman117 / dispatch_joystick.cpp
Last active August 29, 2015 14:15
A small test program for reading events from a joystick/gamepad on Linux using Apple's libdispatch to handle io operations asynchronously.
#include <iostream>
#include <cstring>
#include <cerrno>
#include <unistd.h>
#include <linux/joystick.h>
#include <linux/input.h>
#include <sys/ioctl.h>
#include <dispatch/dispatch.h>
#include <iostream>
#include <cstring>
#include <cerrno>
#include <vector>
#include <unistd.h>
#include <termios.h>
#include <linux/input.h>
#include <sys/ioctl.h>
void Update ()
{
// Movement vector
Vector3 direction = Vector3.zero;
// If the raptor is wandering
if (state == RaptorState.Wandering && controller != null)
{
// Drive the raptor with the controller
direction = controller.inputDirection;
@Kopernicus:AFTER[Kopernicus]
{
Body
{
name = Impa
flightGlobalsIndex = 25
Orbit
{
referenceBody = Kerbin
#include <iostream>
#include <ctime>
#include <chrono>
#include <thread>
#include <mutex>
#include <condition_variable>
using namespace std;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <X11/Xlib.h>
#include <X11/Xlib-xcb.h>
#include <xcb/xcb.h>
@teknoman117
teknoman117 / test.mips.s
Created June 24, 2015 23:53
MIPS -O3 output for reflectcpp
.file 1 "test.cpp"
.section .mdebug.abi32
.previous
.gnu_attribute 4, 1
.abicalls
.option pic0
.section .text._ZN1A3SetEi,"axG",@progbits,_ZN1A3SetEi,comdat
.align 2
.weak _ZN1A3SetEi
$LFB1762 = .
@teknoman117
teknoman117 / constexpr_string_hash.cpp
Last active June 14, 2018 21:45
MurmurHash2 as a C++11 Constant Expression for compiler generated hashes of constant strings
/*
* Copyright (c) 2018 Nathan Lewis <linux.robotdude@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
#version 330 core
#extension GL_EXT_gpu_shader4: enable
#define X_NOISE_GEN 1619
#define Y_NOISE_GEN 31337
#define Z_NOISE_GEN 6971
#define SEED_NOISE_GEN 1013
#define SHIFT_NOISE_GEN 6
#define DEFAULT_PERLIN_FREQUENCY 1.0