Skip to content

Instantly share code, notes, and snippets.

View reillysiemens's full-sized avatar
🦀
cargo install coffee

Reilly Tucker Siemens reillysiemens

🦀
cargo install coffee
View GitHub Profile
@reillysiemens
reillysiemens / signing-vbox-kernel-modules.md
Last active April 25, 2024 03:58
Signing VirtualBox Kernel Modules

Signing VirtualBox Kernel Modules

These are the steps I followed enable VirtualBox on my laptop without disabling UEFI Secure Boot. They're nearly identical to the process described on [Øyvind Stegard's blog][blog], save for a few key details. The images here are borrowed from the [Systemtap UEFI Secure Boot Wiki][systemtap].

  1. Install the VirtualBox package (this might be different for your platform).
    src='https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo'
@reillysiemens
reillysiemens / cards.rs
Created August 11, 2019 06:59
Pretty Rust Cards
use std::fmt;
use std::str;
#[derive(Debug)]
pub enum Rank {
Ace,
Two,
Three,
Four,
Five,
@reillysiemens
reillysiemens / node_nvm_npm_bower.md
Last active June 1, 2022 16:50
Working with Node.js

Using nvm

The easiest way to get started with Node.js is to install [nvm (Node Version Manager)][nvm]. nvm will allow you to install multiple versions of Node.js and switch between them at any time.

Installing nvm

nvm's installation documentation instructs us to install nvm like so

@reillysiemens
reillysiemens / Dockerfile
Last active September 29, 2021 10:05
I was wrong and Alex was right.
FROM python:latest
WORKDIR /test
ADD ./app.py /test
RUN pip install flask psycopg2-binary pytest
CMD ["pytest", "app.py"]
@reillysiemens
reillysiemens / bitmask_battleship.rs
Created March 3, 2021 11:07
Battleship, but it's an int.
//! # Bitmask Battleship
//!
//! The ship sections and their status are maintained in a 17-bit mapping. A
//! zero bit means the section is OK and a one means the section has been hit.
//!
//! ```text,ignore
//! 1
//! 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//! | C | b | c | s | d |
@reillysiemens
reillysiemens / check-prof-pages.sh
Last active February 15, 2021 08:40
Check which WWU CS professors have facultyweb sites.
#!/bin/sh
FACULTYWEB='https://facultyweb.cs.wwu.edu/'
PROF_DIRECTORY='https://cs.wwu.edu/faculty'
USERNAME_PATTERN='<h2 class="title no-margin"><a href="/\K\w+'
PROFS=$(curl -s ${PROF_DIRECTORY} | grep -oP "${USERNAME_PATTERN}")
PADDING=$(for p in $PROFS; do echo $p | wc -c; done | sort | tail -1)
red () {
printf "\e[0;31m${1}\e[0;0m"
@reillysiemens
reillysiemens / README.md
Created December 19, 2018 23:03
Python Typing Optional String Callback

The Python here works just fine, but mypy doesn't like it...

example.py:14: error: Argument 1 to "callback" has incompatible type "Optional[str]"; expected "str"

The if url is None: conditional should prevent the url in the else block from ever being None, but maybe it doesn't work like that? Or I'm just wrong...

@reillysiemens
reillysiemens / instructions.md
Last active December 28, 2018 05:27
Create a Windows 10 USB image from Fedora 29

Instructions

The URL https://git.io/this-time-for-real-tho links to the win10-usb.sh script below. It created something bootable from my Fedora 29 workstation.

Try to run

curl -L https://git.io/this-time-for-real-tho | sh

and if that doesn't work try explicitly setting an environment variable for the location of the .iso file

@reillysiemens
reillysiemens / README.md
Created December 19, 2018 05:54
Python Typing Protocol Default Class

This is perfectly fine Python. It outputs

Opening...
Opening...
1337
Closing...

when run, but Mypy complains...

example.py:29: error: Incompatible default for argument "cls" (default has type "Type[Concrete]", argument has type "SupportsOpenClose")
@reillysiemens
reillysiemens / callback.py
Created December 18, 2018 22:06
Python Callback Type Annotation
def fn(
url: str,
state: State,
payload_type: PayloadType,
verify: bool = True,
method: Callable[..., Response] = requests.post,
) -> None:
"""
Given a function with the above signature, how can the type of
``method`` be made more specific?