Skip to content

Instantly share code, notes, and snippets.

@kylewlacy
kylewlacy / 57-add-emoji-support.conf
Last active January 25, 2024 21:08 — forked from ssaavedra/57-add-emoji-support.conf
Add Emoji to Linux Fontconfig (edited to fix broken fonts for Zoom video conference)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Author: Santiago Saavedra <ssaavedra@gpul.org>, Kyle Lacy
License: CC0
Year: 2016-2017
Install:
Copy to $XDG_CONFIG_DIR/fontconfig/conf.d/57-add-emoji-support.conf
Run fc-cache -f
@kylewlacy
kylewlacy / cartesian_product.scala
Created November 17, 2015 07:38
Cartesian product function in Scala
import scala.reflect.ClassTag
object CartesianProduct {
/**
* Given an array containing a partial Cartesian product, and an array of
* items, return an array adding the list of items to the partial
* Cartesian product.
*
* {{{
* val partialProduct = Array(Array(1, 4), Array(1, 5), Array(2, 4), Array(2, 5))
@kylewlacy
kylewlacy / cartesian_product.rs
Created November 17, 2015 07:28
Cartesian product function in Rust
/// Given a vector containing a partial Cartesian product, and a list of items,
/// return a vector adding the list of items to the partial Cartesian product.
///
/// # Example
///
/// ```
/// let partial_product = vec![vec![1, 4], vec![1, 5], vec![2, 4], vec![2, 5]];
/// let items = &[6, 7];
/// let next_product = partial_cartesian(partial_product, items);
/// assert_eq!(next_product, vec![vec![1, 4, 6],
@kylewlacy
kylewlacy / README.md
Created October 3, 2021 00:31
Systemd service to disable Proxmox VE nagware

Here's a Systemd service that will automatically disable the "No valid subscription" nagware dialog in Proxmox VE. I got the snippet to disable the dialog from this article from John's Computer Services.

  1. Save the systemd service to /etc/systemd/system/proxmox-patcher.service
  2. Save the shell script to /root/proxmox-patcher.sh
  3. Run chmod +x /root/proxmox-patcher.sh as root
  4. Run systemctl enable proxmox-patcher.service as root
  5. Restart
@kylewlacy
kylewlacy / nixos-install.log
Created March 10, 2018 07:30
Fix for error during NixOS UEFI installation: "Failed to create EFI Boot variable entry: No such file or directory"
# Tested with nixos-minimal-18.03pre130932.cc4677c36ee-x86_64-linux.iso
# Manually mounted /mnt (NixOS root), /mnt/boot (mkfs.ext4 Grub partition), /mnt/boot/efi (mkfs.vfat for EFI boot vars)
[root@nixos:~]# cat /mnt/etc/nixos/hardware-configuration.nix
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
@kylewlacy
kylewlacy / prepend-append.sh
Last active February 24, 2022 09:25
How to prepend or append to a variable in bash
# Prepend to a variable
export PATH=/foo${PATH:+:$PATH} # Set path to "/foo:$PATH", or "/foo" if $PATH is empty
# Append to a variable
export PATH=${PATH:+$PATH:}/foo # Set path to "$PATH:/foo", or "/foo" if $PATH is empty
@kylewlacy
kylewlacy / attaching-a-directory.md
Last active May 6, 2021 17:44
Attaching a directory to a libvirtd VM

Attaching a directory from a host to a libvirtd guest VM

NOTE: These instructions aren't comprehensive! This just covers the main roadblocks every time I need to re-do this process...

(For context, I'm using a Debian 10 host and a Debian 10 guest)

1. Create the directory and update the permissions so libvirtd-qemu has access:

host $ mkdir vmshared
@kylewlacy
kylewlacy / java_interop.clj
Last active November 8, 2020 18:53
Small DSL for making Java classes in Clojure, using ASM
; Based on https://gist.github.com/athos/1033052
(ns cljl.java-interop
(:require [clojure.string :as str])
(:import (clojure.asm Opcodes Type ClassWriter)
(clojure.asm.commons Method GeneratorAdapter)))
(def ^:dynamic *version* Opcodes/V1_6)
(def modifier->opcode
@kylewlacy
kylewlacy / Base64.sh
Created May 28, 2012 18:12
Shell Script Base64 Encoder
#!/bin/bash
#Dependent on some OS X stuff; should be pretty easy to make compatible on different Unicies
#Make sure you run 'chmod +x Base64.sh' to be able to run it
#Run in Terminal and pass the file as an argument, or pass the file in during the prompt
if [ -z "$1" ]; then
read -p "What file do you want to encode? " file
else
file=$1
fi

Keybase proof

I hereby claim:

  • I am kylewlacy on github.
  • I am kylewlacy (https://keybase.io/kylewlacy) on keybase.
  • I have a public key ASDjZ5rjzY281WRUgbzoHHVpqkAfc3IjfxWzuNtSbLv-FQo

To claim this, I am signing this object: