Skip to content

Instantly share code, notes, and snippets.

View cobalthex's full-sized avatar
💭
maybe?

cobalthex

💭
maybe?
View GitHub Profile
@cobalthex
cobalthex / StripTags.cpp
Last active December 24, 2023 06:35
String ops
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
const char* c_ws = " \r\n\t";
using s32 = int;
void StripTags(std::string& line)
{
@cobalthex
cobalthex / DisableNvUsbCWake.cpp
Last active November 11, 2021 18:32
Stop NVidia's USB C controller from waking machine (requires elevation)
#define UNICODE
#include <Windows.h>
#include <PowrProf.h>
#pragma comment(lib, "PowrProf.lib")
const wchar_t szDeviceName[] = L"NVIDIA USB Type-C Port Policy Controller";
int main()
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,0e,00,3a,00,00,00,00,00
@cobalthex
cobalthex / pillars.cpp
Created October 26, 2020 02:30
Pillars (old old old crusty shit)
//headers for fake music (to disable it)
typedef struct { } Mix_Music;
int Mix_PlayMusic(void* dat, int n) { return 0; }
Mix_Music* Mix_LoadMUS(char* s) { return 0; }
int Mix_GetError() { return 0; }
int Mix_FadeOutMusic(int n) { return 0; }
int Mix_FadeInMusic(void* d, int nn, int n) { return 0; }
int Mix_PlayingMusic() { return 0; }
int Mix_CloseAudio() { return 0; }
@cobalthex
cobalthex / EntityEditor.ui.tk
Created February 22, 2019 21:38
Dying And More! data file examples
List {
Name: "Entity properties editor";
IsModal: true;
HorizontalAlignment: Alignment.Middle;
VerticalAlignment: Alignment.Middle;
BackgroundColor: [32 0 128 192];
Margin: 10;
Padding: 10;
Children: [
@cobalthex
cobalthex / Missile.ent.tk
Last active December 1, 2017 07:42
TK Lang examples
ProjectileClass {
Name: "Missile";
MuzzleVelocity: 500;
DestroyIfOffscreen: True;
IgnoreTrace: True;
Range: 200;
FadeEffect: {
Effects: [
EntityEffect {
@cobalthex
cobalthex / Vec2.js
Last active June 1, 2016 18:30
Some math stuff
function Vec2(X, Y)
{
this.x = X;
this.y = isNaN(Y) ? X : Y;
};
Vec2.prototype =
{
toString: function()
{
return "{x: " + this.x + ", y: ", + this.y + "}";
@cobalthex
cobalthex / C++.md
Last active May 30, 2021 06:38
Good to knows

items with asterick (*) considered more advanced/esoteric

  1. Stack vs heap (memory)
    • What are both
    • when is the stack used
    • when is the heap used
    • how can the heap be avoided
    • performance of the heap
  2. Cache locality
  3. Object lifetime
@cobalthex
cobalthex / a test.plang
Created October 16, 2015 09:00
Plang test
//comment
/* also a comment */
//defines a custom binary operator
//with left-associativity and precidence of 15
//prefix and postfix are both urnary operators
//ternary operators can be emulated with tuples
#operator =!= infix left 15
vあr = 3 + 5.0 * 4;
@cobalthex
cobalthex / .vimrc
Created October 2, 2015 18:08
Terminal configs
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
set nu
syntax on
set smartindent
set tabstop=4
set mouse=a