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
@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 / proper_ls
Last active November 28, 2022 03:59
The proper format for ls replacement.
## The proper format for ls to lsd replacement.
if [ $(command -v lsd) ]; then
alias ls='lsd --color=always'
alias la='lsd -a --color=always'
alias ll='lsd -la --color=always'
else
alias ls='ls --color=always'
alias la='ls -a --color=always'
alias ll='ls -la --color=always'
fi
@YourFriendCaspian
YourFriendCaspian / convert_bash_aliases_to_scripts
Last active November 25, 2023 17:15
Converts all bash aliases to script files
#!/bin/bash
# Convert bash aliases to bash scripts.
#
# Copyright 2018 <[email protected]>, licensed under the GPL-3.0+
#
# Usage:
# convert_bash_aliases_to_scripts # converts all bash aliases to script files
# convert_bash_aliases_to_scripts clean # removes all scripts previously converted by this script
COLOR_RED=$'\e[0;31m'
@YourFriendCaspian
YourFriendCaspian / extract
Created November 24, 2022 01:31
Extract script borrowed from druskus20
!#/bin/bash
# Extract script borrowed from druskus20
# https://github.com/druskus20/
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
@YourFriendCaspian
YourFriendCaspian / theme.bash
Last active November 21, 2022 22:40
VonHeikemen bash prompt
#!/usr/bin/env bash
# bash prompt by VonHeikemen
# https://github.com/VonHeikemen/dotfiles/blob/master/my-configs/bash/theme.bash
black="\[\e[0;30m\]"
red="\[\e[0;31m\]"
green="\[\e[0;32m\]"
yellow="\[\e[0;33m\]"
blue="\[\e[0;34m\]"
#!/bin/sh
# From ChrisTitusTech
https://github.com/ChrisTitusTech/scripts/blob/master/status.sh
## =============================================================================
## REGULAR COLOROS
K='\033[0;30m' # black
R='\033[0;31m' # red
G='\033[0;32m' # green
@YourFriendCaspian
YourFriendCaspian / bash_prompt
Created November 18, 2022 14:16
VonHeikemen bash prompt
#!/usr/bin/env bash
# https://github.com/VonHeikemen/dotfiles/blob/master/my-configs/bash/theme.bash
# theme.bash prompt by VonHeikemen
black="\[\e[0;30m\]"
red="\[\e[0;31m\]"
green="\[\e[0;32m\]"
yellow="\[\e[0;33m\]"
blue="\[\e[0;34m\]"
@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 / test-volt
Created November 6, 2022 01:53
Measure the voltage out of our PSU
#!/bin/bash
awk '{printf ("%0.2f",$1/172.5); }' </sys/devices/iio_sysfs_trigger/subsystem/devices/iio\:device0/in_voltage6_raw
@YourFriendCaspian
YourFriendCaspian / notes_sync.sh
Last active February 13, 2022 12:17
To help sync notes from Obsidian to Github
#!/usr/bin/env sh
# Forked from https://gist.github.com/tallguyjenks/ca3339b8b5353159f631836268e3f791
# All credit goes to https://gist.github.com/tallguyjenks
# ^^^^^^^^^^^^^^^ This says find the first instance of a sh (shell)
# binary and use that shell to execute these commands.
# There is little to no complexity here and no bashisms so it
# should work just fine on most systems and instances of shells
# (bash, zsh, sh, etc.)
NOTES_PATH="PATH TO YOUR VAULT"