Skip to content

Instantly share code, notes, and snippets.

View djfdyuruiry's full-sized avatar

matthew snoddy djfdyuruiry

View GitHub Profile
@djfdyuruiry
djfdyuruiry / get-fastest-ubuntu-mirror.sh
Created February 16, 2023 23:59
Outputs the response times for each Ubuntu apt-get mirror from fastest to slowest
#! /usr/bin/env bash
set -e
wget -qO - mirrors.ubuntu.com/mirrors.txt | xargs -I {} curl -w "%{time_total} - {}\n" -s -o /dev/null {} | sort
@djfdyuruiry
djfdyuruiry / Dockerfile
Last active October 5, 2022 22:52
Pokered Docker Build
FROM ubuntu:jammy AS tools
ENV BUILD_DIR /build
ENV RGBDS_DIR ${BUILD_DIR}/rgbds
ENV RGBDS_VER v0.5.2
ENV POKE_DIR ${BUILD_DIR}/pokered
ENV ROM_FILENAME=pokered.gbc
@djfdyuruiry
djfdyuruiry / convert_biom_to_tsv.py
Created May 21, 2022 21:06
Example of how to convert biom format data to a tsv file
# requires the package 'json-stream'
import json_stream
import os
import shutil
scratchDir = "scratch"
def get_biom_row_count(biomFileName):
biomFile = open(biomFileName)
biomData = json_stream.load(biomFile)
@djfdyuruiry
djfdyuruiry / get-dgVoodoo2-latest.ps1
Created January 14, 2021 15:12
Download Lastest dgVoodoo 2 Wrapper
$dgVoodooArchiveUrl = "http://dege.freeweb.hu/dgVoodoo2/bin"
$latestZip = Invoke-WebRequest -UseBasicParsing -Uri $dgVoodooArchiveUrl | `
Select-Object -ExpandProperty Links | `
Select-Object -ExpandProperty href | `
Where-Object { $_ -match "dgVoodoo2_\d+(_\d+)*[.]zip" } | `
Sort-Object | `
Select-Object -Last 1
Invoke-WebRequest -UseBasicParsing -Uri "${dgVoodooArchiveUrl}/${latestZip}" -OutFile $latestZip
@djfdyuruiry
djfdyuruiry / loop-over-infantry.lua
Created July 5, 2020 18:25
NCO mod: Iterate over infantry example
for idx, infantryType in ipairs(getInfantryTypes()) do
-- do stuffs
end
@djfdyuruiry
djfdyuruiry / ubuntu-20.04-wsl2.ps1
Created May 29, 2020 00:20
Ubuntu 20.04 in WSL 2
## change to your username
$user="wsl-user"
# download latest 20.04 release
curl --location `
--remote-name `
"https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-wsl.rootfs.tar.gz"
# import into WSL 2
wsl --import `
@djfdyuruiry
djfdyuruiry / README.md
Last active October 8, 2024 04:54
WSL 2 - Enabling systemd

Enable systemd in WSL 2

NOTE: If you have Windows 11 there is now an official way to do this in WSL 2, use it if possible - see MS post here (WINDOWS 11 ONLY)

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

@djfdyuruiry
djfdyuruiry / README.md
Last active March 7, 2024 03:41
WSL 2 - XServer Setup

WSL 2 XServer Setup

This guide will setup WSL 2 to be able to connect to an XServer installed on your host Windows machine. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2. The XServer software used was VcXsrv; remember to disable authentication for this to work correctly.

  • Open a WSL terminal

  • Fix an issue with dbus:

sudo sh -c "dbus-uuidgen > /etc/machine-id"

@djfdyuruiry
djfdyuruiry / README.md
Last active June 1, 2024 17:50
WSL 2 - Fix DNS Issues

Fix DNS Issues in WSL 2

This guide will help overcome the DNS issues present in WSL 2 while still making the Windows host IP autogenerated by WSL available for use. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • Open a WSL terminal

  • Copy the contents of configure-wsl-dns.sh to /opt/configure-wsl-dns.sh:

sudo nano /opt/configure-wsl-dns.sh

@djfdyuruiry
djfdyuruiry / download-vagrant.sh
Created March 6, 2020 16:15
Bash script that automatically downloads the latest Vagrant Ubuntu package
#! /usr/bin/env bash
set -e
vagrantBaseUrl="https://releases.hashicorp.com"
latestRelease=$(\
wget -q -O - "${vagrantBaseUrl}/vagrant/" \
| grep 'a href="' \
| grep -v '<a href="../">../</a>' \
| head -n 1 \