Skip to content

Instantly share code, notes, and snippets.

View mikelane's full-sized avatar
💾
Engineering Software

Mike Lane mikelane

💾
Engineering Software
  • Portland, OR
View GitHub Profile
@mikelane
mikelane / .envrc
Created March 29, 2024 00:20
$HOME/workplace/infrastructure/.envrc
export FLAKE_BASE=$HOME/nixos/my-company
export FLAKE_PATH=$FLAKE_BASE/${PWD##*/}
watch_file $FLAKE_PATH/flake.nix
watch_file .env
use flake $FLAKE_PATH --impure
export PYTHONPATH=$PWD
@mikelane
mikelane / flake.nix
Created March 29, 2024 00:17
$HOME/my-company/infrastructure/flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devenv.url = "github:cachix/devenv";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
@mikelane
mikelane / configuration.nix
Created March 29, 2024 00:12
$HOME/hosts/desktop/configuration.nix
{ config, lib, pkgs, helix, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
../../openrgb
];
@mikelane
mikelane / default.nix
Created March 29, 2024 00:04
$HOME/nixos/home/mikelane/default.nix
{ config, pkgs, pkgs-stable, ... }:
{
imports = [
./shell
./programs
];
home = {
username = "mikelane";
@mikelane
mikelane / flake.nix
Created March 29, 2024 00:00
$HOME/nixos/flake.nix
{
description = "Mike's NixOS Flake";
nixConfig = {
experimental-features = [ "nix-command" "flakes" ];
extra-substituters = [
# Nix community's cache server
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
@mikelane
mikelane / generate-commit-message
Created February 27, 2024 22:20
A script that sends the diff of staged files to shell-gpt so that it can create a nifty commit message.
#!/usr/bin/env bash
check_commands_available() {
local missing_cmds=()
local cmds=("sgpt" "pandoc") # Add any other required commands to this array
for cmd in "${cmds[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
missing_cmds+=("$cmd")
fi
@mikelane
mikelane / .gitignore
Created March 1, 2021 01:52
Default .gitignore for python projects
*.env
# Created by .ignore support plugin (hsz.mobi)
### Diff template
*.patch
*.diff
### Windows template
# Windows thumbnail cache files
Thumbs.db
@mikelane
mikelane / shunting_yard.py
Last active January 16, 2021 23:11
Shunting Yard Algorithm in Python
import re
from collections import deque
from typing import List, Union
def tokenize(expression: str) -> List[Union[int, str]]:
tokens = [
int(token)
if token.isnumeric()
else token
@mikelane
mikelane / game_of_life.py
Last active March 21, 2022 22:52
Conway's Game of Life implemented using a 2d convolution.
import click
import difflib
import numpy as np
import random
import sys
import time
from os import name, system
from scipy.ndimage import convolve
def draw_square(side_length: int) -> None:
for _ in range(4):
turtle.forward(side_length)
turtle.right(90)
def draw_concentric_squares(number_of_squares: int = 5, radius_increase: int = 20) -> None:
turtle.begin_fill()
for length in range(radius_increase, 2 * number_of_squares * radius_increase, radius_increase * 2):
draw_square(length)
x, y = turtle.pos()