Skip to content

Instantly share code, notes, and snippets.

View YourFriendCaspian's full-sized avatar
🙃
I'm sure I'll be slow to respond so don't be mad.

yourfriendcaspian YourFriendCaspian

🙃
I'm sure I'll be slow to respond so don't be mad.
View GitHub Profile
function prompt_wikimatze_precmd {
git-info
}
function prompt_wikimatze_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
@YourFriendCaspian
YourFriendCaspian / dexec.sh
Created June 28, 2023 03:11 — forked from papes1ns/dexec.sh
dexec.sh
#!/usr/bin/env bash
set -eu # do not proceed on error
if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Quick command to get a shell inside a running docker container.
Usage: dexec [container_name] [command]
@YourFriendCaspian
YourFriendCaspian / .gitconfig
Last active February 9, 2023 13:37 — forked from chrismccoy/gitcheats.txt
gitconfig cheatsheet
# list all tags
git fetch --all --tags --prune
# sort git tags by date
git for-each-ref --sort=taggerdate --format '%(tag)_,,,_%(taggerdate:raw)_,,,_%(taggername)_,,,_%(subject)' refs/tags | awk 'BEGIN { FS = "_,,,_" } ; { t=strftime("%Y-%m-%d %H:%M",$2); printf "%-20s %-18s %-25s %s\n", t, $1, $4, $3 }'
# delete all local tags, and update with list of remote tags
git tag -l | xargs git tag -d && git fetch -t
# get list of all author's emails of the repo
@YourFriendCaspian
YourFriendCaspian / show-ls-colors.sh
Created November 26, 2022 15:22 — forked from chrisniael/show-ls-colors.sh
Display environment variable LS_COLORS
#!/bin/bash
# Fork from https://github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
# Script to show the colours used for different file types
# This is just a more readable version of the 'eval' code at:
# http://askubuntu.com/a/17300/309899
# A nice description of the colour codes is here:
@YourFriendCaspian
YourFriendCaspian / .bashrc
Last active May 1, 2023 10:36 — forked from rot26/.bashrc
[.bashrc.d] Use bashrc directory instead of bashrc #bash #bashrc
# Add this to your ~/.bashrc file
# Use .bashrc.d directory instead of bloated .bashrc file
# From: https://waxzce.medium.com/use-bashrc-d-directory-instead-of-bloated-bashrc-50204d5389ff
BASHRC_DIR="${HOME}/.bashrc.d"
# Optionally create directory if not exists
if [ ! -d "${BASHRC_DIR}" ]; then
mkdir -p "${BASHRC_DIR}";
chmod 700 "${BASHRC_DIR}";
fi
# Load any *.bashrc files in ~/.bashrc.d/
@YourFriendCaspian
YourFriendCaspian / fish_greeting.fish
Created November 25, 2022 17:40
~/.config/fish/functions/fish_greeting.fish
function fish_greeting -d "Greeting message on shell session start up"
echo ""
echo -en " __ " (welcome_message) "\n"
echo -en " >(' ) " (show_date_info) "\n"
echo -en " ) / " "\n"
echo -en " / ( " "Computer specific:\n"
echo -en " / `-----/ " (show_os_info) "\n"
echo -en " \ ~=- / " (show_installation_date) "\n"
echo -en "~^~^~^~^~^~^~^ " (show_cpu_info) "\n"
echo -en "~^~^~^~^~^~^~^ " (show_ram_info) "\n"
@YourFriendCaspian
YourFriendCaspian / magpi.py
Created November 6, 2022 02:00
Script to download all MagPi PDF's - skips existing PDF's - pip install bs4
'''
Download all MagPis available
'''
#!/usr/bin/env python3
# pip install bs4
import ntpath
import os
import sys
import urllib.request
@YourFriendCaspian
YourFriendCaspian / kodi_install_rpi_bullseye.txt
Last active January 29, 2022 16:19 — forked from shivasiddharth/gist:1c457e62413e7a1441dcab11b0fe7757
Fix Kodi Raspberry Pi OS No installation candidate issue
sudo sh -c "echo 'deb http://ftp.us.debian.org/debian/ bullseye main contrib non-free' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb http://deb.debian.org/debian bullseye main contrib non-free' >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXXXX
Replace XXXXXXXXXX with the first alphanumeric key.
sudo apt-get update
sudo apt-get install kodi
@YourFriendCaspian
YourFriendCaspian / noop_sync.vbs
Created January 25, 2022 15:48 — forked from j1n6/noop_sync.vbs
Powershell to sync and push to remote git repository via Windows Scheduled Tasks
' Hack to workaround the Powershell Console popup running on a Windows Scheduled Task
' Powershell limitations: https://github.com/PowerShell/PowerShell/issues/3028
'
' Add this file in the same git root directory as the sync.ps1
'
Dim shell,command
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim sScriptDir : sScriptDir = oFSO.GetParentFolderName(WScript.ScriptFullName)
command = "powershell.exe -nologo -File " & sScriptDir & "\sync.ps1"
@YourFriendCaspian
YourFriendCaspian / runit.md
Created October 30, 2021 12:12 — forked from brutella/runit.md
Get started with runit