Skip to content

Instantly share code, notes, and snippets.

@rougier
rougier / dual-header.el
Created December 30, 2024 19:08
Emacs dual header line
;; Dual header line is possible by exploiting the tab-bar line that
;; sits on top of the header line and is generally hidden. For the
;; icon, it has to be precisely cut in top and bottom part and each
;; part is concatenated with either the tab-line or header-line.
(defun dual-header (top bottom)
"This installs a double line header in current buffer using both tab line (TOP) and header line (BOTTOM)."
(set-face-attribute 'tab-line (selected-frame)
@kmatt
kmatt / void-wsl.txt
Last active March 9, 2025 17:01
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
@ruandre
ruandre / nix-on-wsl-debian-ubuntu.md
Last active January 2, 2025 17:55
Nix on WSL Debian/Ubuntu

Nix on WSL Debian/Ubuntu

Prep

Install these if not already available:

sudo apt install curl xz-utils
@andrebrait
andrebrait / keychron_linux.md
Last active March 14, 2025 22:43
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@adnan360
adnan360 / sway-on-void-linux.md
Last active March 5, 2024 05:33
Running Sway (Wayland) on Void Linux (without SystemD)

Running Sway on Void Linux (without SystemD)

elogind is the part of SystemD logind that can run as standalone. So we need it to run Sway without SystemD. To do that we need to build wlroots with elogind option. Then we can install and use Sway as normal from the current repo. There are other ways to achieve this without elogind here. But I tried with the elogind option and I was successful.

UPDATE: I tried again on a fresh install. The elogind option is set by default on the repo version. So you can skip the xbps-src command below and continue. wlroots should install as a dependency of sway if you follow the later commands.

git clone git://github.com/void-linux/void-packages.git
cd void-packages
./xbps-src binary-bootstrap
@Ananto30
Ananto30 / sse.go
Last active September 5, 2024 23:04
SSE message stream in Go
// Example SSE server in Golang.
// $ go run sse.go
// Inspired from https://gist.github.com/ismasan/3fb75381cd2deb6bfa9c
package main
import (
"encoding/json"
"fmt"
"log"
@romainl
romainl / grep.md
Last active March 16, 2025 21:14
Instant grep + quickfix

FOREWORDS

I don't mean the snippet at the bottom of this gist to be a generic plug-n-play solution to your search needs. It is very likely to not work for you or even break things, and it certainly is not as extensively tested and genericised as your regular third-party plugin.

My goal, here and in most of my posts, is to show how Vim's features can be leveraged to build your own high-level, low-maintenance, workflows without systematically jumping on the plugins bandwagon or twisting Vim's arm.


Instant grep + quickfix

@fumiyas
fumiyas / openssh-build-static.sh
Created October 4, 2017 09:20
Build OpenSSH with static linked zlib and OpenSSL libraries
#!/bin/sh
set -u
set -e
umask 0077
prefix="/opt/openssh"
top="$(pwd)"
root="$top/root"
build="$top/build"
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active March 10, 2025 07:17
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@col
col / Deploy a Phoenix app with Dokku.md
Last active December 21, 2024 03:40
Deploy a Phoenix app with Dokku