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 / node-and-npm-in-30-seconds.sh
Last active November 24, 2015 15:13 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh
@mikelane
mikelane / index.html
Created December 6, 2015 02:32 — forked from mbostock/.block
Hierarchical Edge Bundling
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
font: 300 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
fill: #bbb;
}
.node:hover {
@mikelane
mikelane / # graphviz - 2016-11-02_07-57-07.txt
Last active November 2, 2016 15:00
graphviz on macOS 10.12.2 - Homebrew build logs
Homebrew build logs for graphviz on macOS 10.12.2
Build date: 2016-11-02 07:57:07
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()
@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
@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 / .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 / 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 / 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 / default.nix
Created March 29, 2024 00:04
$HOME/nixos/home/mikelane/default.nix
{ config, pkgs, pkgs-stable, ... }:
{
imports = [
./shell
./programs
];
home = {
username = "mikelane";