Skip to content

Instantly share code, notes, and snippets.

View lobre's full-sized avatar

Loric Brevet lobre

View GitHub Profile
@fabi1cazenave
fabi1cazenave / kanata.kbd
Created December 3, 2023 10:36
kanata configuration : 4×10 + 3 thumb keys
;; Quick notes about the kanata configuration syntax:
;; - the syntax is Lisp-like but totally unrelated to Lisp, so no worries :-)
;; - comments are prefixed by double-semicolons
;; - only one `defsrc` is allowed, listing all keys handled by kanata
;; - up to 25 `deflayer` are allowed, one per layer emulation
;; - the underscore symbol `_` in `deflayer` sections means "transparent",
;; i.e. the previous layer behaviour is used when pressing that key
;; `defsrc` defines the keys that will be intercepted by kanata.
;; The order of the keys matches with deflayer declarations and all deflayer
@gdamjan
gdamjan / default.nix
Last active November 26, 2022 12:19
A demo "Portable Service" for a shell program built with nix - https://systemd.io/PORTABLE_SERVICES/
{ pkgs ? import <nixpkgs> { } }:
let
demo-program = pkgs.writeShellScriptBin "helloWorld" "while sleep 3; do echo Hello World; done";
demo-service = pkgs.substituteAll {
name = "demo.service";
src = ./demo.service.in;
demoExe = "${demo-program}/bin/helloWorld";
};
demo-socket = pkgs.concatText "demo.socket" [ ./demo.socket ];
@dojoteef
dojoteef / softwrap.kak
Last active May 15, 2024 15:57
Enable softwrap in kakoune and fix associated movement issues
# Softwrap long lines (and correct for improper kakoune movement behavior)
add-highlighter global/softwrap wrap -word -indent
define-command goto-center -docstring 'Jump to the center of the view' %{
execute-keys %sh{
echo $kak_window_range $kak_cursor_line | (
read y x h w l
num_lines=$((l-y-(h+1)/2))
if [ $num_lines -lt 0 ]; then
echo "${num_lines##-}j"
elif [ $num_lines -gt 0 ]; then
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@j-maas
j-maas / README.md
Last active November 21, 2023 07:51
Roc: Open and closed tag unions

Roc: Open and closed tag unions

People's intuition

As evidenced in the discussions on Zulip (1, 2, 3) there are some cases where open and closed tags behave in a way that goes against people's intuition.

The main problem seems to be that people expect produced values to compose, but the "default" syntax (without *) prohibits this. People understand the openness to mean whether all possible values are listed, not whether more values can be added "later". For example: Roc infers myValue = if True then One else Two to be an open tag unio

Untitled CSS Library RFP

Untitled CSS Library is a CSS library that, so far as I can tell, does not exist.

It offers the following features:

  • It renders well out of the box with Vanilla HTML, like a classless CSS library such as pico
  • It takes advantage of semantic, lesser used tags such as nav, main and section to allow for more elaborate layouts in pure HTML
  • It offers "High Power" classes that capture high level components in, as much as is possible, a single CSS class
@progrium
progrium / cli.go
Created September 2, 2021 01:13
350 line reimplementation of cobra, simplified and with no dependencies
package cli
import (
"bytes"
"context"
"flag"
"fmt"
"os"
"reflect"
"strings"
@romainl
romainl / path.md
Last active April 17, 2024 07:42
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
@AkdM
AkdM / Edit_Repack_ISO_tutorial.md
Last active April 25, 2024 11:34
Edit and repack .iso bootable image

On Linux

Installing mkisofs

apt-get install mkisofs

Editing ISO image

mkdir /tmp/custom_iso

@JonCole
JonCole / Redis-DebuggingKeyspaceMisses.md
Last active February 22, 2024 09:49
Redis Debugging Tips

Debugging Redis Keyspace Misses

Simply put, a keyspace "MISS" means some piece of data you tried to retrieve from Redis was not there. This usually means that one of the following things happened:

  1. The key expired
  2. They key was renamed
  3. The key was deleted
  4. The key was evicted due to memory pressure
  5. The entire database was flushed
  6. The key was never actually inserted