Skip to content

Instantly share code, notes, and snippets.

View c0deaddict's full-sized avatar

Jos van Bakel c0deaddict

View GitHub Profile
@c0deaddict
c0deaddict / hd44780.lua
Created November 13, 2015 21:22
NodeMCU HD44780
local bor, band, bnot = bit.bor, bit.band, bit.bnot
local function write4bits(self, bits, char_mode)
tmr.delay(1000)
gpio.write(self.pin_rs, char_mode and gpio.HIGH or gpio.LOW)
for n = 1, 2 do
for i, pin in ipairs(self.pin_db) do
local j = (2-n)*4 + (i-1)
local val = (bit.isset(bits, j))

Keybase proof

I hereby claim:

  • I am c0deaddict on github.
  • I am josvanbakel (https://keybase.io/josvanbakel) on keybase.
  • I have a public key whose fingerprint is 6568 423D 20F2 00A8 0A4E 9D56 3758 9FBA E4DA 2BC3

To claim this, I am signing this object:

Language LOC
c 3181
python 1156
ruby 1067
elm 6701
js 1629
java 3052
haskell 3182
racket 1221
perl 2097
@c0deaddict
c0deaddict / default.nix
Created August 20, 2019 09:16
NixOS custom nodePackages
{ pkgs, nodejs, stdenv }:
let
nodePackages = import ./composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
};
in
nodePackages
@c0deaddict
c0deaddict / Casper.rb
Last active June 24, 2021 14:17
Adoptidee Spindle nr 1: Casper
live_loop :casper do
use_synth :piano
2.times do
sleep 0.5
play :a
sleep 0.2
play :b
sleep 0.2
play :a
sleep 0.2
@c0deaddict
c0deaddict / Liza, Quinta en Eldar.rb
Last active June 24, 2021 14:17
Adoptidee Spindle nr 2: Liza Quinta en Eldar
use_bpm 90
live_loop :kick do
sample :bd_haus
sleep 0.5
end
live_loop :snare do
sleep 0.5
sample :sn_dolf
sleep 0.5
end
{ config, pkgs, lib, ... }:
let
interfaces = {
wan = "enp1s0";
lan = "enp2s0";
};
in {
@c0deaddict
c0deaddict / nixos-container-in-wireguard-vpn.nix
Created August 10, 2021 13:29
NixOS container in Wireguard VPN network namespace
{ lib, config, pkgs, ... }:
with lib;
let
veth = "veth-vpn";
hostIp = "10.0.0.1/24";
guestIp = "10.0.0.2/24";
@c0deaddict
c0deaddict / lxc.nix
Created January 1, 2022 17:02
Declarative LXD config
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.mine.lxc;
format = pkgs.formats.json { };
preseedFile = format.generate "preseed.yaml" cfg.preseed;
@c0deaddict
c0deaddict / mautrix-whatsapp.nix
Created February 27, 2022 12:54
mautrix-whatsapp.nix
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.services.mautrix-whatsapp;
dataDir = "/var/lib/mautrix-whatsapp";
format = pkgs.formats.json { };
registrationFile = "${dataDir}/whatsapp-registration.yaml";