Skip to content

Instantly share code, notes, and snippets.

View djfdyuruiry's full-sized avatar

matthew snoddy djfdyuruiry

View GitHub Profile
@djfdyuruiry
djfdyuruiry / README.md
Last active April 28, 2024 08:34
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 / quartz.properties
Created July 6, 2018 08:40
File Based Quartz Scheduler JDBC JobStore using H2
# On disk local Quartz JobStore using H2; add 'com.h2database:h2:1.4.197' to your dependencies
org.quartz.scheduler.instanceName = MyScheduler
org.quartz.threadPool.threadCount = 3
# generic jdbc job store
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource = disk
# persist to H2 database at path '/tmp/MyScheduler.quartz.h2'
@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 / alpine-lua
Created August 19, 2018 21:15
Docker container which provides a Lua interpreter with access to luarocks; uses alpine linux as the base image
#!/usr/bin/env ash
read -r -d '' PROMPT_LUA << EOM
_PROMPT = '[alpine-lua]# '
luarocks =
{
install = function(pkg)
return os.execute('luarocks install ' .. pkg)
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 / MultiThreadedCsvReaderWriter.java
Last active August 25, 2023 11:25
Multi-threaded CSV Reader/Writer for Java
// uses Apache commons CSV, IO and Lang
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@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 / gitlabApiClient.sh
Last active May 19, 2022 20:23
GitLab API Client Written in Bash
#!/usr/bin/env bash
########################################################################################################################
# #
# GitLab API client written in Bash using the `curl` command #
# ----------------------------------------------------------- #
# See: https://gist.github.com/djfdyuruiry/9eecf631e3b43fce2a4393d23e03c1ce #
# #
# Using global configuration: #
# #
# export GITLAB_URL="https://my-g