Skip to content

Instantly share code, notes, and snippets.

View liquidev's full-sized avatar
🌳
growing a tree @ liquidex.house

liquidex liquidev

🌳
growing a tree @ liquidex.house
View GitHub Profile
@liquidev
liquidev / 00-readme.md
Last active October 16, 2022 13:25
Mandelbrots

Mandelbrots

An assortment of obfuscated Mandelbrot implementations in Lua. Originally started by me, optimized further by Zevv.

@liquidev
liquidev / 00-readme.md
Last active April 25, 2022 12:11
CCrsync - a primitive clone of rsync for ComputerCraft

CCrsync

It's a primitive """clone""" of rsync for ComputerCraft. I needed a program that would incrementally download files off of a static website served by nginx, onto my in-game computer.

Setup

To set up your website, simply enable JSON autoindexing in nginx. For instance:

location /ccst/ {
@liquidev
liquidev / class.md
Last active April 30, 2024 16:24
My attempt at explaining how to implement classes in Lua

If you're reading this document, you're probably one of many people confused about how to implement OOP-like classes in Lua. But no worries! This document aims to explain all the fundamental concepts in beginner-friendly language.

Metatables

Before we start, we need to talk about metatables. These are Lua's way of allowing users to overload operators. Operators include arithmetic +, -, *, /, etc., but also things like indexing tables a[b], creating new indices in tables a[b] = c, function calls, a(b, c, d), you get the idea.

We can set the metatable of a table using setmetatable(t, metatable). The metatable is another table, that contains fields for overriding

@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 / 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 / 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 / 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 / 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

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 / 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")