Skip to content

Instantly share code, notes, and snippets.

View SamuelDavis's full-sized avatar

Samuel Davis SamuelDavis

  • Stallings, NC, USA
View GitHub Profile

In all interactions be extremely concise and sacrifice grammar for the sake of concision.

Git

Do not attempt to change the Git commit history. Do not attempt to commit changes to Git. Always defer to the user to commit code.

Plans

@SamuelDavis
SamuelDavis / deploy.sh
Last active August 2, 2026 19:10
Deploy to gh-pages for projects with `npm run build` to `dist/` (e.g. Vite)
#!/usr/bin/env bash
REMOTE_ORIGIN=$(git config --get remote.origin.url)
if [ $? -ne 0 ]; then
echo "Git repository not found." >&2
exit 1
fi
REPO_NAME=$(basename -s .git "$REMOTE_ORIGIN")
DOMAIN=${1:-"$REPO_NAME.sdavis.online"}
@SamuelDavis
SamuelDavis / empty-favicon.html
Last active October 25, 2025 16:44
Empty Favicon
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">
@SamuelDavis
SamuelDavis / gvim
Last active August 2, 2026 03:25
Start Nvim for Godot; when opening a .gd file in Godot, defer to either a running instance of Neovim if it exists, or a new one.
#!/usr/bin/env bash
set -euo pipefail
exec 2>>"/tmp/godot-nvim.log"
SOCK="${XDG_RUNTIME_DIR:-/tmp}/godot-nvim.sock"
FILE="${1:-}"
FILE="$(realpath -- "$FILE")"
LINE="${2:-1}"
@SamuelDavis
SamuelDavis / docker-compose.yml
Created March 7, 2025 22:13
Dockerize many PHP Sites with HTTPS
services:
nginx:
image: nginx:alpine
container_name: web
depends_on:
- php
ports:
- "80:80"
- "443:443"
volumes:
@SamuelDavis
SamuelDavis / with-cuda.nix
Last active January 12, 2025 00:17
Support Cuda for PyTorch in NixOS
# Run with `nix-shell cuda-shell.nix`
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "cuda-env-shell";
buildInputs = with pkgs; [
git gitRepo gnupg autoconf curl
procps gnumake util-linux m4 gperf unzip
cudatoolkit linuxPackages.nvidia_x11
libGLU libGL
xorg.libXi xorg.libXmu freeglut
@SamuelDavis
SamuelDavis / init.lua
Last active August 25, 2025 01:18
Neovim Configuration File
local args = vim.fn.argv(0)
if arg ~= "" then
local path = vim.fn.fnamemodify(args, ":p")
if vim.fn.isdirectory(path) == 0 then
path = vim.fn.fnamemodify(args, ":h")
end
if vim.fn.isdirectory(path) == 1 then
vim.cmd.cd(path)
vim.fn.remove(vim.v.argv, 1)
end
@SamuelDavis
SamuelDavis / config
Last active January 2, 2025 22:41
SwayWM Config
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
@SamuelDavis
SamuelDavis / dockerrc.sh
Created April 12, 2024 23:29
useful docker functions
docker-prune () {
for CMD in "$@"
do
echo "Pruning ${CMD}s..."
IDS=$(docker $CMD ls --all --quiet 2> /dev/null || docker $CMD ls --quiet)
[ -z "$IDS" ] && echo "None found." && continue
echo "$IDS" | xargs -L1 docker $CMD rm --force
docker $CMD prune --force
done
}
@SamuelDavis
SamuelDavis / .bashrc
Last active September 16, 2024 12:13
useful scripts
eval $(ssh-agent -s) 1> /dev/null
export USER_ID=$(id --user)
export GROUP_ID=$(id --group)
export DENO_DIR="$HOME/.deno"
PATH="$PATH:$HOME/.npm/bin"
alias nixos-clean="sudo nix-collect-garbage --delete-old"
alias nixos-list="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"
alias dpa="dprune container volume network"