Skip to content

Instantly share code, notes, and snippets.

View Agent-E11's full-sized avatar

Eamon Burns Agent-E11

View GitHub Profile
const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const translate_c = b.addTranslateC(.{
@Agent-E11
Agent-E11 / install_fonts.ps1
Last active November 26, 2024 03:04
A simple PowerShell script to install all fonts of a certain type in a folder. Adapted from this Stack Overflow question: https://stackoverflow.com/questions/77829662/a-powershell-script-to-install-fonts-on-windows-11
param (
# Folder to search recursively for fonts to install
[string]$Folder = "$Env:USERPROFILE\Fonts\Ensure Installed",
# Array of glob patterns to match
[string[]]$Types = ("*.fon", "*.otf", "*.ttc", "*.ttf")
)
# Go through all folders in source and list all files
if (Test-Path -Path $Folder -Type Container) {
$fontList = Get-ChildItem `
@Agent-E11
Agent-E11 / default_prompt.sh
Last active November 15, 2024 06:30
A simple profile to define a custom Bash prompt. Should be put in `/etc/profile.d/` (to be applied to all users), or sourced from your personal `.bashrc` file.
# Exit if non-interactive
[[ -z "$PS1" ]] && return
_colors=false
if [[ -x /usr/bin/tput ]] && tput setaf 1 >&/dev/null; then
# tput is executable, and it doesn't fail when trying to set the foreground color
_colors=true
else
case "$TERM" in
@Agent-E11
Agent-E11 / jeopardy_time.py
Created April 24, 2024 20:27
Simple game time calculator for btc-raspberrypiclub/jeopardy
"""
This is a simple script to calculate the maximum possible time that
a github.com/btc-raspberrypiclub/jeopardy game should take, using the
given variables.
"""
def input_default(prompt: str, default: int) -> int:
"""
Get input from the user, appending
f" ({default}): " to the given prompt.
@Agent-E11
Agent-E11 / 01-basic-config.yaml
Last active December 10, 2023 07:15
basic server `netplan` config
# Make sure that the `/etc/netplan` folder is not accessable by users other than root
# e.g. `chmod 660 -R /etc/netplan`
network:
version: 2
renderer: NetworkManager # You can also use `networkd`
ethernets:
enp0s3: # It is possible that you will need to change this. Run `ip address show` to list your network interfaces
dhcp4: no
addresses: [192.168.0.100/24] # Set your own static IP(s) here (using CIDR notation)
@Agent-E11
Agent-E11 / main.rs
Last active March 10, 2023 04:44
Basic tic tac toe program written in Rust
use std::io;
use ndarray::{self, arr2, Array2, Array1};
fn main() {
let cell_empty: char = '-';
let stdin = io::stdin();
let mut grid = arr2(&[
[cell_empty, cell_empty, cell_empty],
[cell_empty, cell_empty, cell_empty],