Skip to content

Instantly share code, notes, and snippets.

View SamuelDavis's full-sized avatar

Samuel Davis SamuelDavis

  • Stallings, NC, USA
View GitHub Profile
@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.sh
Last active April 10, 2024 14:23
useful scripts
function pruneDocker () {
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 / configuration.nix
Last active March 20, 2024 01:16
NixOS Global Config
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
nix = {
package = pkgs.nix;
settings.experimental-features = [ "nix-command" "flakes" ];
set ideajoin
set ignorecase
set smartcase
let mapleader = ","
let localmapleader = ","
map <leader>cr <Action>(RenameElement)
map <leader>ca <Action>(ShowIntentionActions)
map <leader>/ <Action>(CommentByLineComment)
@SamuelDavis
SamuelDavis / arch-install.sh
Last active July 17, 2023 11:58
Arch Linux Installation
# Internet access
#################
iwctl station list # list devices
NET_DEVICE="MyDevice"
iwctl station $NET_DEVICE scan
iwctl station $NET_DEVICE get-networks # list networks
NET_NAME="MyNetwork"
NET_PASS="MyPassword"
iwctl --passphrase $NET_PASS station $NET_DEVICE connect $NET_NAME
@SamuelDavis
SamuelDavis / template-project.bash
Created July 11, 2023 22:47
Template Svelte / Solid projects
#!/usr/bin/bash
if [ "$#" -ne 2 ]; then
echo "Incorrect number of arguments."
exit 1
fi
BRANCH=$1
URL="https://github.com/SamuelDavis/templates/archive/refs/heads/$BRANCH.zip"
TEMP_FILE="/tmp/templates-$BRANCH.zip"
set title
" Styling
syntax on
colorscheme slate
" Search
set incsearch " incrementally highlight search while typing
" Sidebar
@SamuelDavis
SamuelDavis / component_proxy_type.ts
Last active February 12, 2023 20:43
An example of typing a proxy object to get/set properties in bitESC's components
import {
addComponent,
addEntity,
createWorld,
defineComponent,
defineQuery,
type ComponentType,
type IWorld,
Types,
type ISchema,
@SamuelDavis
SamuelDavis / init.lua
Last active March 19, 2023 13:52
Hammerspoon Config
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
@SamuelDavis
SamuelDavis / .bashrc
Last active May 5, 2022 01:25
Arch Linux installation/configuration
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export BROWSER="brave-bin"
export _JAVA_AWT_WM_NONREPARENTING=1 # dwm support for phpstorm
export PATH="$PATH:$HOME/code/scripts"