Skip to content

Instantly share code, notes, and snippets.

View liquidev's full-sized avatar

riki liquidev

View GitHub Profile
@liquidev
liquidev / list.md
Last active July 9, 2020 12:15
Programming resources
@liquidev
liquidev / compiling.md
Last active December 8, 2019 21:07
Turn your joypad to a mouse
cc jm.c -lxdo -lSDL2 -lm -o jm -O3
./jm

Only tested with an Xbox 360 Wireless Controller.

Default bindings:

  • Left joystick - move cursor
  • Right joystick - scroll
  • A - left click
@liquidev
liquidev / sdl2.nim
Last active October 16, 2019 16:56
Nimterop SDL2 wrapper
## An SDL2 wrapper using nimterop.
import os
import nimterop/build
import nimterop/cimport
const
Base = getProjectCacheDir("sdl2")

Config

  • WM: i3-gaps
  • Wallpaper
  • Font
  • Compositor: compton-tryone
  • Bar: polybar
  • Terminal: alacritty
  • rofi: default, looks good enough but I might customize at some point

Config files and scripts below.

@liquidev
liquidev / lava_lamp.nim
Created January 7, 2020 15:57
A lava lamp effect in OpenGL, using an alpha threshold shader.
import math
import os
import parseopt
import random
import strutils
import rapid/gfx
import rapid/res/textures
import rapid/res/images
import rapid/gfx/fxsurface
@liquidev
liquidev / main.c
Created August 22, 2020 14:59
Novation Launchpad I/O with ALSA
#include <stdio.h>
#include <string.h>
#include <alsa/asoundlib.h>
#define LOG(...) do { \
fprintf(stderr, __VA_ARGS__); \
fflush(stderr); \
} while (0)
@liquidev
liquidev / main.c
Created August 22, 2020 20:25
Novation Launchpad S to keyboard/mouse controls script, for torturing yourself
#include <stdio.h>
#include <string.h>
#include <alsa/asoundlib.h>
#include <math.h>
#include <unistd.h>
#include <xdo.h>
#define LOG(...) do { \
fprintf(stderr, __VA_ARGS__); \
@liquidev
liquidev / language_nim.lua
Last active November 6, 2020 15:23
my lite plugins
local syntax = require "core.syntax"
local patterns = {}
local symbols = {
["nil"] = "literal",
["true"] = "literal",
["false"] = "literal",
}
@liquidev
liquidev / editorconfig.lua
Created February 17, 2021 14:26
lite plugin for .editorconfig support. currently unfinished!
-- MIT License
--
-- Copyright (c) 2021 liquidev
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
@liquidev
liquidev / class.md
Last active February 8, 2025 21:44
My attempt at explaining how to implement classes in Lua

NOTE (2025-02-08)

I've since moved the tutorial over to my website. Clarified some of the wording, added exercises at the end, added links to useful resources.

For historical reasons, I'm keeping the original text here. But if you've just stumbled upon this tutorial for the first time, you may want to check out the revised version!

https://riki.house/programming/lua/classes