Skip to content

Instantly share code, notes, and snippets.

View mthadley's full-sized avatar
💾
Loading...

Michael Hadley mthadley

💾
Loading...
View GitHub Profile
#!/usr/bin/env ruby
require "io/console"
class Keyboard
def initialize(queue) = @queue = queue
def monitor
return if @thread
@mthadley
mthadley / redis_keys.rb
Last active June 16, 2022 20:06
`dump` or `restore` Redis keys
#!/usr/bin/env ruby
require "bundler/inline"
require "json"
require "base64"
gemfile do
source "https://rubygems.org"
gem "redis", "~> 4.6"
@mthadley
mthadley / uptime.rb
Created April 12, 2022 23:21
Uptime Checker for HTTPS Services
#!/usr/bin/env ruby
require "net/http"
require "openssl"
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "colorize", "~> 0.8"
@mthadley
mthadley / custom-install.sh
Last active November 29, 2020 19:56
OpenCL Install Script for AMDGPU PRO driver on Ubuntu 20.04
#!/usr/bin/env bash
#
# Author: Michael Hadley
# Tested on:
# OS: Ubuntu 20.04
# Kernel: 5.8.0-29-generic
# Pro Driver: 20.45
#
# Custom install script for the OpenCL components of the "AMDGPU-PRO" driver. I was unable to use the
# script that came with the driver asit always atempted to install componetns that depend on the amdgpu-dkms
#!/usr/bin/env nix-shell
#! nix-shell -i runhaskell -p ghcid ghc
import Control.Applicative
import Data.Char
import Data.List
import Data.Maybe
import Text.Read
main :: IO ()
@mthadley
mthadley / randomize_server.rb
Created March 29, 2020 01:24
The Randomizer™️
#! /usr/bin/env nix-shell
#! nix-shell -i ruby -p ruby bundler --pure
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem 'sinatra'
gem 'thin'
@mthadley
mthadley / server.rb
Created March 29, 2020 00:31
Portable Nix/Ruby Web Server
#! /usr/bin/env nix-shell
#! nix-shell -i ruby -p ruby bundler --pure
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem 'sinatra'
gem 'thin'
@mthadley
mthadley / start_pihole.sh
Created January 10, 2020 19:27
Pihole startup script
#!/bin/bash
# Remove existing container
docker stop pihole
docker rm pihole
docker run -d \
--name pihole \
-e TZ="America/Los_Angeles" \
-e ServerIP="192.168.1.201" \
module Url.Parser.Extra exposing (const)
import Url.Parser
{-| A parser that "almost always" succeeds.
Maybe you want to convert an existing application to be an SPA
without actually adding a route type yet:
Url.Parser.Extra.const () : Url.Parser.Parser (() -> ()) ()
@mthadley
mthadley / Makefile
Created August 19, 2019 02:37
Makefile with npm and node-sass
# Get a list of all sass src files. We use the `shell` function
# to run a normal command and store the result in this variable.
SCSS_SRC = $(shell find src/scss -iname "*.scss")
# Make a list of all the files we want as output, so...
# src/scss/header.scss
# gets tranformed to...
# dist/header.css
CSS = $(addprefix dist/, $(notdir $(SCSS_SRC:.scss=.css)))