Skip to content

Instantly share code, notes, and snippets.

View falloutphil's full-sized avatar

falloutphil

  • UK
View GitHub Profile

Keybase proof

I hereby claim:

  • I am falloutphil on github.
  • I am beadling (https://keybase.io/beadling) on keybase.
  • I have a public key ASCCElQg9BPs7FyCLB9hglmwpwjNUQrrFj-VvZtLLkFUaQo

To claim this, I am signing this object:

@falloutphil
falloutphil / make-mega-adblock-hostsfile.sh
Last active January 5, 2020 15:13
Create Mega Adblock Hostsfile for use with Dnsmasq (Modified from Pi-hole)
#!/bin/bash
# Modified Pi-hole script to generate a generic hosts file
# for use with dnsmasq's addn-hosts configuration
# original : https://github.com/jacobsalmela/pi-hole/blob/master/gravity-adv.sh
# taken from: https://gist.github.com/chrisvella/5f3a18f1e442153cd685#file-make-mega-adblock-hostsfile-sh
# You can also get more blocks from:
# https://www.hostsfile.org/hosts.html
# Specifically:
# https://www.hostsfile.org/Downloads/BadHosts.unx.zip
@falloutphil
falloutphil / bindings.txt
Created January 11, 2020 00:15
Konsole Key Bindings for Emacs Terminal
To get windmove to work and stuff like this: https://ebzzry.io/en/emacs-pairs/
https://unix.stackexchange.com/questions/76566/where-do-i-find-a-list-of-terminal-key-codes-to-remap-shortcuts-in-bash
https://emacs.stackexchange.com/questions/977/shiftup-isnt-recognized-by-emacs-in-a-terminal/989#989
Settings -> Edit Current Profile -> Keyboard
But also check that it's not overridden in Settings -> Configure Shortcuts
S-Up \E[1;2A
@falloutphil
falloutphil / 99-noto-mono-color-emoji.conf
Last active June 12, 2020 17:41 — forked from IgnoredAmbience/99-noto-mono-color-emoji.conf
Noto Emoji Color fontconfig for Konsole
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Noto Mono + Color Emoji Font Configuration for KDE/Konsole
Konsole/KDE apps use QT rather than the GTK emoji setup. So standard Ubuntu setup doesn't seem to work.
https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1767390
If you want the Snake emoji in your Python venv Powerline then see below!
@falloutphil
falloutphil / scheme-read-file-numbers.org
Last active December 28, 2021 13:16
Some ideas about how to efficiently read a file of numbers in scheme a la AoC

To test we create a file much larger than we’d read in with a typical AoC question - let’s mimic day 11 of 2021 (also valid for day 09 too) available here.

shuf -i 1000000000-9999999999 -n 10000000 -o big_test.txt

With a file this big, my original solution runs out of memory due to garbage collection issues. The problem here was misunderstanding eager comprehensions - the nested map should be part of the list comprehension itself not applied afterwards!

A good link about comprehensions in Scheme for reference.

@falloutphil
falloutphil / guix-qemu-ubuntu.org
Last active April 7, 2022 23:01
Running Ubuntu under Guix using QEmu, and then installing Cuis Smalltalk

There is no WSL or Multipass on Guix, but we can get the same thing with QEmu (and a lot more). But it’s a bit trickier to get started!

Guix packages required:

  • qemu (possibly can get away with minimal package)
  • cloud-utils (for cloud-localds)
  • cdrkit-libre (for genisoimage, used by cloud-localds)

Create the following user data file - there may be more in this than you need.

@falloutphil
falloutphil / gist:d406365f3eabf337e6821440d44fe33f
Last active July 3, 2022 23:28
Using Framebuffer instead of X Windows
Can be used from qemu Ubuntu instance (see other gist).
Clone and build this on the host:
https://github.com/ponty/framebuffer-vncserver
Run it *as root*:
sudo ./framebuffer-vncserver -t /dev/input/by-path/platform-i8042-serio-1-event-mouse -k /dev/input/by-path/platform-i8042-serio-0-event-kbd
You can use the direct /dev/input/eventX as well if you want.

Interfacing C with Emacs Lisp

Introduction

This document provides a step-by-step guide for interfacing C with Emacs Lisp, designed for readers familiar with basic Ubuntu, C, and Emacs usage.

Installing Necessary Tools

GNU Scientific Library (GSL)

  • Install GSL: sudo apt-get install libgsl-dev

Emacs

(I compiled Emacs 29.1 from source, but this should also work)

  • Install Emacs: sudo apt-get install emacs