Skip to content

Instantly share code, notes, and snippets.

View nat-418's full-sized avatar

Nat nat-418

View GitHub Profile
@nat-418
nat-418 / hyper-key.desktop
Last active July 26, 2023 06:52
How to enable the Hyper key on Linux
[Desktop Entry]
Name[en_US]=hyper-key
Comment[en_US]=Set CapsLock to Control and Escape to Hyper
Exec=/usr/local/bin/hyper-key.sh
Icon=application-default-icon
X-GNOME-Autostart-enabled=true
Type=Application
@nat-418
nat-418 / Hyper.md
Created March 27, 2022 19:35 — forked from toroidal-code/Hyper.md
Have you a Hyper for Great Good

Have you Hyper for Great Good

So. You have become an Emacs wizard. And you find yourself aching for the simplicity that another modifier key would introduce into your life. Ah, the things you could do with Hyper.

Or maybe, you just want Hyper for another reason.

... Except everywhere you look, everyone's talking about .xmodmaps and xkbcomp, but you're using one of those fancy desktop managers. (Aka, not awesome, dwm, xmonad or something even more hipster) And because of that, you're lost in the sea of confusion that is trying to customize your keyboard mapping.

Gnome, Cinnamon, and KDE all use xkb.

@nat-418
nat-418 / nix-home-manager-neovim-setup.md
Last active May 25, 2024 19:42
Manage Neovim plugins (and more!) with Nix and Home Manager

Manage Neovim plugins (and more!) with Nix and Home Manager

Highly extensible software like Emacs, Vim, and Neovim tend to grow their own package managers. A software developer, for example, might want to install editor plugins that hook into a particular programming language's linter or language server. The programmer's text editor is therefore extended to support managing additional software to extend the text editor. If this loop continues for too long, the programmer's editor becomes more delicate and complex. The remedy for this problem is to manage software using dedicated tools apart

@nat-418
nat-418 / expecting.md
Created January 8, 2023 15:16 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@nat-418
nat-418 / a-sensible-nixos-xfce-configuration.md
Last active April 11, 2024 16:17
A sensible NixOS Xfce configuration

A sensible NixOS Xfce Configuration

NixOS provides good support for the Xfce desktop environment out-of-the-box, but the defaults are minimal. The files in this Gist provide a more complete experience, including a suite of basic software and plugins as well as an optional home-manager configuration for theming.

The key additions to the default Xfce provided by NixOS are:

  • Complete bluetooth / audio support with panel indicators and apps
  • LightDM with theme
  • Extra Xfce apps for calendaring, disk partitioning, etc.
  • Various quality-of-life improving non-essentials
@nat-418
nat-418 / libvirt.nix
Last active April 16, 2023 14:07
Basic NixOS configuration for desktop libvirt virtualization
# This file should be sourced in your /etc/nixos/configuration.nix
# imports declaration.
{ pkgs, ... }:
{
environment = {
systemPackages = with pkgs; [
libguestfs-with-appliance
libvirt
libvirt-glib
@nat-418
nat-418 / a-basic-home-manager.md
Last active May 16, 2024 20:49
An example Home Manager configuration

A basic Home Manager configuration

These files show a simplified real-world example of how to use Home Manager to setup Neovim, Xfce, and some command-line user tools.

@nat-418
nat-418 / why-tcl.md
Last active April 1, 2024 03:23
Why Tcl?

Why Tcl?

Introduction

I use [Tcl] as my scripting language of choice, and recently someone asked me why. This article is an attempt to answer that question.

Ousterhout's dichotomy claims that there are two general categories of programming languages:

@nat-418
nat-418 / from-init.lua-to-default.nix.md
Last active April 16, 2024 23:40
Advanced Neovim configuration with Nix and Home Manager

From init.lua to default.nix

In a previous post I explained how to manage Neovim plugins with Nix and Home Manager. In this post I want to go further and show how to migrate Neovim configuration from ~/.config/nvim to ~/.config/home-manager entirely. The end result will be to split our Neovim setup into multiple modules that colocate plugin sourcing and configuration.

If you haven't read the post linked above, do so now. We will assume the

@nat-418
nat-418 / how-to-build-with-nix.md
Last active April 24, 2024 14:57
How to build with Nix

How to build with Nix

[Nix] is a cross-platform package manager and domain-specific language used to define packages. In this article, I will demonstrate how to write and contribute Nix packages to [Nixpkgs], the [world's largest software repository]. I assume that you, dear reader, already know the basics of software development. Nix brings a number of advantages over comparable packaging solutions, most importantly:

  • more reproducible builds
  • a large and welcoming community