Skip to content

Instantly share code, notes, and snippets.

View daviwil's full-sized avatar

David Wilson daviwil

View GitHub Profile
@sherjilozair
sherjilozair / sdl-sokol-sprite.c
Created June 9, 2018 14:05
Minimal sprite rendering example with SDL2 for windowing, sokol_gfx for graphics API using OpenGL 3.3 on MacOS
#include <OpenGL/gl3.h>
#include <SDL2/SDL.h>
#define SOKOL_IMPL
#define SOKOL_GLCORE33
#include <sokol_gfx.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#define CODE(...) #__VA_ARGS__
@Aerijo
Aerijo / making_language_grammar.md
Last active March 18, 2024 05:03
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@pesterhazy
pesterhazy / promises-passing-values.cljs
Last active October 24, 2021 00:55
Promise chains in ClojureScript and the problem of previous values
(ns my.promises
"Demo to show different approaches to handling promise chains in ClojureScript
In particular, this file investigates how to pass data between Promise
callbacks in a chain.
See Axel Rauschmayer's post
http://2ality.com/2017/08/promise-callback-data-flow.html for a problem
statement.
@mortennobel
mortennobel / SingleFileOpenGLTex.cpp
Last active January 25, 2024 10:03
Single file OpenGL 3.3 / WebGL (using Emscripten) example with texture (SDL2 / SDL_Image 2)
//
// Compile for emscripten using
// emcc -Iinclude SingleFileOpenGLTex.cpp \
-O2 -std=c++14 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file examples/data -s USE_SDL=2 -o html/SingleFileOpenGLTex.html
// where the following images must be located in a subfolder
// - examples/data/test.png
// - examples/data/cartman.png
// - examples/data/cube-negx.png
// - examples/data/cube-negz.png
//
@abn
abn / 00-lenovo-x1-5th-gen-thinkfan-setup.md
Last active January 30, 2024 19:31
Fedora thinkfan configuration for Lenovo X1 Carbon (5th Gen)

Thinkfan Configuration Notes

This are notes for configuration thinkfan for Fedora. This configuration procedure was followed on a Lenovo Thinkpad X1 Carbon (5th Gen) running Fedora 25.

Non standard (default) configuration was required for this machine as the default sensors are not available. Eg: /proc/acpi/ibm/thermal does not exist for this model.

An annoted configuration file has been included below. However, there is no guarentee that this will work as-is on every machine.

Installation

dnf -y install thinkfan
@meirbon
meirbon / Dell XPS 15 9560 Manjaro Setup instructions
Last active March 31, 2024 01:21
Small, quick guide to set up Manjaro on the XPS 15 9560
# 1. First of all of course get Manjaro:
https://manjaro.org/get-manjaro/
# I recommend using Etcher to copy the image to your USB:
https://etcher.io/
# 2. Before installing make sure:
# - Secure boot is disabled in BIOS
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much
@attacus
attacus / riot-matrix-workshop.md
Last active March 13, 2024 00:16
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

Name Value
---- -----
BreakAllDebuggerShortcut Ctrl+B
CloseRunspaceShortcut Ctrl+W
CloseScriptShortcut Ctrl+F4
Copy2Shortcut Ctrl+Ins
Cut1Shortcut Ctrl+X
Cut2Shortcut Shift+Del
EditorBoxSelectLineDownShortcut Alt+Shift+Down
EditorBoxSelectLineUpShortcut Alt+Shift+Up
@knoxyca
knoxyca / vscode.reg
Last active October 6, 2016 18:35
This is a registry entry that will add Open with VSCode Insiders to all users on a system.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VSCodeInsiders]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,77,00,69,00,74,00,68,00,20,00,43,00,6f,\
00,64,00,65,00,20,00,2d,00,20,00,49,00,6e,00,73,00,69,00,64,00,65,00,72,00,\
73,00,00,00
"Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,\
4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,53,00,20,\
00,43,00,6f,00,64,00,65,00,20,00,49,00,6e,00,73,00,69,00,64,00,65,00,72,00,\
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class NativeConsoleMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr GetStdHandle(int handleId);