Skip to content

Instantly share code, notes, and snippets.

@bspaulding
bspaulding / Makefile
Last active October 9, 2021 00:38
java app makefile
APP_NAME := $(shell basename $(shell pwd))
BUILD_DIR := build
SRC_DIR := src
SRCS := $(shell find $(SRC_DIR) -name '*.java')
CLSS := $(SRCS:$(SRC_DIR)/%.java=$(BUILD_DIR)/%.class)
.PHONY: run
run: $(BUILD_DIR)/$(APP_NAME).jar
java -jar $(BUILD_DIR)/$(APP_NAME).jar $(args)
@bspaulding
bspaulding / bspaulding-dev-clojure-deployment.yaml
Created July 7, 2021 22:01
dev container deployment example
apiVersion: apps/v1
kind: Deployment
metadata:
name: bspaulding-dev-clojure-deployment
labels:
app: bspaulding-dev-clojure
spec:
selector:
matchLabels:
app: bspaulding-dev-clojure
@bspaulding
bspaulding / Dockerfile
Last active April 22, 2021 22:46
spim dockerfile
FROM alpine
RUN apk add subversion make bison g++ flex
WORKDIR /spim-src
RUN svn checkout svn://svn.code.sf.net/p/spimsimulator/code/ spimsimulator-code
RUN cd spimsimulator-code/spim && make install
RUN rm -rf /spim-src
set -g default-terminal "xterm"
setw -g mode-keys vi
set -sg escape-time 10
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
bind | split-window -h
@bspaulding
bspaulding / refactoring-tools.md
Created April 2, 2019 18:26
Refactoring Tools Research / ideas

Automated Refactoring

Refactorings

  • Rename variable
  • Extract variable
  • Extract constant
  • Extract field (Java)
  • Type migration
  • Extract Component (React)
{-# LANGUAGE DeriveGeneric, OverloadedStrings, OverloadedLabels #-}
module Main where
import Database.Selda
import Database.Selda.SQLite
import Database.Selda.Backend
data Pet = Dog | Horse | Dragon
deriving (Show, Read, Bounded, Enum)
instance SqlType Pet
// Levenshtein Distance
// https://en.wikipedia.org/wiki/Levenshtein_distance
function distance(a, b) {
if (!a.length || !b.length) {
return 0;
}
const cost = a[a.length - 1] === b[b.length - 1] ? 0 : 1;
const atrim = a.slice(0, a.length - 1);
const btrim = b.slice(0, b.length - 1);
@bspaulding
bspaulding / analyze-deps.js
Last active November 14, 2018 17:42
Convert dependencies in package.json to the exact versions currently installed.
const fs = require('fs');
const prettier = require('prettier');
const package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
function updateDeps(deps) {
let newDeps = {};
for (let name in deps) {
const version = deps[name];
if(!version.match(/^([0-9]|file:|git)/)) {
const localPackage = JSON.parse(fs.readFileSync(`./node_modules/${name}/package.json`));
# Configuration for Alacritty, the GPU enhanced terminal emulator
# The FreeType rasterizer needs to know the device DPI for best results
# (changes require restart)
dpi:
x: 96.0
y: 96.0
# Display tabs using this many cells (changes require restart)
tabspaces: 2
<html>
<script>
alert("hello, shortcuts");
</script>
</html>