Skip to content

Instantly share code, notes, and snippets.

View DonaldKellett's full-sized avatar

Donald Sebastian Leung DonaldKellett

View GitHub Profile
@DonaldKellett
DonaldKellett / README.md
Last active July 11, 2023 14:36
Markdown to styled HTML page using Python-Markdown and Bootstrap CSS for my serverless blog engine on Alibaba Cloud

Markdown to styled HTML page using Python-Markdown and Bootstrap CSS for my serverless blog engine on Alibaba Cloud

A simple blogging engine for swiftly authoring blog posts using Markdown and have them converted to professional-looking HTML pages on the fly

Execution environment

Alibaba Cloud Function Compute with the appropriate configuration

In particular, make sure Python-Markdown is installed and an OSS bucket containing your Markdown blogs is mounted under /mnt/donaldsebleung-blog/ with at least read permissions

@DonaldKellett
DonaldKellett / Dockerfile
Created August 7, 2022 15:06
docker.io/donaldsebleung/cgreen
FROM docker.io/library/ubuntu:jammy
RUN set -ex; \
buildDeps='git ca-certificates build-essential cmake'; \
apt-get update; \
apt-get install -y --no-install-recommends gcc $buildDeps; \
cd /tmp; \
git clone --recurse-submodules --branch 1.6.0 https://github.com/cgreen-devs/cgreen.git; \
cd cgreen; \
make; \
@DonaldKellett
DonaldKellett / Dockerfile
Last active August 7, 2022 23:30
docker.io/donaldsebleung/criterion
FROM docker.io/library/ubuntu:jammy
RUN set -ex; \
buildDeps='git ca-certificates build-essential cmake'; \
apt-get update; \
apt-get install -y --no-install-recommends gcc $buildDeps; \
cd /tmp; \
git clone --recurse-submodules --branch v2.3.3 \
https://github.com/Snaipe/Criterion; \
cd Criterion; \
@DonaldKellett
DonaldKellett / 90-logitech-c930e.rules
Last active February 16, 2023 02:54
Disable autofocus and specify absolute focus for Logitech c930e with udev and systemd (Fedora 35 Workstation)
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0843", TAG+="systemd", ENV{SYSTEMD_WANTS}="logitech-c930e@$env{MINOR}.service"
@DonaldKellett
DonaldKellett / fcos-test-day.ign
Created January 7, 2022 13:56
My Ignition file for provisioning FCOS with custom user "dsleung"
{
"ignition": {
"version": "3.3.0"
},
"passwd": {
"users": [
{
"name": "dsleung",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzSI7uKPqNJTCO9uaqFvSdk+A/vmkwJ/ef9hjku8BEau+NTd89K54g4sZwwVsnEkM9ZkgQ7TqaHs6qhG0xJoc82h8w34uzVglHsSAsY1D2FtuhT4dtwUq7+E2ZFj454rH23rrb3haFdROBizOIMCs01WH0muNKhU9a1O9EQZ42oG6boJqbhw3jWErUFZn4MhtN1FZDx1U2YY6B2VfnfeJvJG819WDor+MypScoD+/Z5Vjt/H4pgMxJSlLk6HFSuop7HHnSH3UzsT+VamxVCOvuN0mx6xm7kOvYp4HfKGKTQMyb+KIOWmr7XG4zG6H0j7STiQVjnVYzfgxnlUg607+Sti02N2dU73SnSn4A7v2Fht+6UjWxMqbugjT+QHH30QV3mwGbjdxwvEqifOGeXK/Khn2FLcW4pbinHce7vOOUBb3+mY/8qRvJHn7aRnHSKTj0jAuE5dRgG1UcYmDVUhyZD+6/Jf7/vF4zHI7B6MA8GSxx9+QeGhSDSrr5rEgBh/0= donaldsebleung@donaldsebleung-MacBookAir"
@DonaldKellett
DonaldKellett / hello-winsock.cpp
Last active May 29, 2021 09:24
"Hello Winsock!" HTTP server from first principles using Winsock (Windows 10)
#undef UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#define _WIN32_WINNT 0x501
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
@DonaldKellett
DonaldKellett / COMP4521.ps1
Last active May 22, 2021 09:06
Simple Windows PowerShell script I made for processing and zipping submission material for COMP 4521 at HKUST
Param ($PrefixFile, $ProjectFolder)
# Credits: https://devblogs.microsoft.com/powershell-community/borrowing-a-built-in-powershell-command-to-create-a-temporary-folder/
Function New-TemporaryFolder {
# Make a new folder based upon a TempFileName
$T="$($Env:temp)\tmp$([convert]::tostring((get-random 65535),16).padleft(4,'0')).tmp"
return (New-Item -ItemType Directory -Path $T)
}
if (-not (Test-Path $PrefixFile -PathType Leaf)) {
@DonaldKellett
DonaldKellett / comp4521.sh
Last active May 22, 2021 11:41
Simple Bash script for Linux I made for processing and zipping submission material for COMP 4521 at HKUST
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: /path/to/comp4521.sh prefix project"
echo "Where:"
echo "- prefix is the file to prepend to all JavaScript programs"
echo "- project is the project directory to apply the action to"
exit 1
fi
@DonaldKellett
DonaldKellett / SIMPLE_DEB_PKG_GUIDE.md
Created April 3, 2021 10:29
Simple Debian Packaging Guide

Writing this for myself and others since most documentation online, official or otherwise, tend to make it look way more complicated than it really is.

  1. Install the required packages: $ sudo apt install build-essential devscripts dh-make lintian
  2. Fetch the source code: $ wget https://example.com/path/to/pkgname/vx.y.z.tar.gz
  3. Unpack the source code: $ tar xvf /path/to/your/vx.y.z.tar.gz
  4. Make sure the unpacked source code is in all lowercase
  5. Change directory to the unpacked source code: $ cd /path/to/your/pkgname-x.y.z
  6. Run this: $ dh_make --native. Choose s for arch-specific stuff, i for arch-independent stuff (such as Node.js programs)
  7. This creates a debian/ subdirectory in the source code. Delete all files except the following in debian/ (if the other files are required, we can add them back later):
@DonaldKellett
DonaldKellett / ListAppInj.v
Created February 12, 2020 10:59
Injectivity of list concatenation from first principles in Coq
(* Proving injectivity of list concatenation from first
principles - no stdlib, no automation *)
(* Definition of a list *)
Inductive list (A : Type) : Type :=
| nil
| cons (x : A) (xs : list A).
Arguments nil {A}.
Arguments cons {A} _ _.