Skip to content

Instantly share code, notes, and snippets.

View DrSpeedy's full-sized avatar

DrSpeedy

  • United States
  • 14:39 (UTC -05:00)
View GitHub Profile
@DrSpeedy
DrSpeedy / weather.zsh
Created September 19, 2016 08:42
Get weather from the command line
#!/bin/zsh
# Simple function to get weather from command line via curl
# To use either add to zshrc/bashrc, or run the command `source weather.zsh`
export LOC="kalamazoo"
# If no location is provided, weather for $LOC will be returned
function wthr() {
if [ -z "$1" ]; then
echo "$(curl -silent wttr.in/$LOC)"
@DrSpeedy
DrSpeedy / dLocker.sh
Last active June 19, 2023 17:28
Prototype linux directory locker
#!/bin/bash
# dLocker.sh by Brian Wilson
#
# Quick and dirty prototype for a directory locker
#
# Initialization Example:
# $ cd dLocker
# $ ls
# dLocker/ dLocker.sh
@DrSpeedy
DrSpeedy / fulgur.md
Created January 30, 2018 05:09
Fulgur Workstation basic rundown

Fulgur Workstation

Maintainer: Brian Wilson [email protected]

GIT: ssh://[email protected]:wiltech/fulgur.git

======

Introduction:

Fulgur Workstation is a light-weight highly configurable workstation platform for software and networking development.

Top Level Features:

@DrSpeedy
DrSpeedy / oceanic-next-alphabg.patch
Created April 1, 2018 15:33
OceanicNext vim theme transparent background patch
diff --git a/colors/OceanicNext.vim b/colors/OceanicNext.vim
index 1c496b2..cda25f9 100644
--- a/colors/OceanicNext.vim
+++ b/colors/OceanicNext.vim
@@ -53,10 +53,10 @@ function! <sid>hi(group, fg, bg, attr, attrsp)
exec "hi " . a:group . " guifg=" . a:fg[0]
exec "hi " . a:group . " ctermfg=" . a:fg[1]
endif
- if !empty(a:bg)
- exec "hi " . a:group . " guibg=" . a:bg[0]
@DrSpeedy
DrSpeedy / bash_dialog.conf
Last active April 14, 2018 00:56
Run-time configuration file for bash dialog
#
# Run-time configuration file for bash dialog
# Path: /etc/dialogrc
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?)
@DrSpeedy
DrSpeedy / compton.conf
Created April 14, 2018 01:09
Compton configuration based in i3wm with nouavue on Arch Linux
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "xrender";
@DrSpeedy
DrSpeedy / .zshrc
Last active April 21, 2018 10:24
Automatically change working directories in NeoVim via the terminal
# This function calls the script below when loaded by
# the shell inside of neovim. It must be placed somewhere in
# your default shell's rc file e.g. ~/.zshrc
neovim_autocd() {
[[ $NVIM_LISTEN_ADDRESS ]] && neovim-autocd.py
}
chpwd_functions+=( neovim_autocd )

BASH CHEAT SHEET

Text processing

# Read file without empty lines and new line comments with grep
grep -v '^$\|^\s*\#' /path/to/file.txt
# Read file without empty lines, or any comments even on shared lines
if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="yellow"; fi
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
PROMPT='
[ %{$fg_bold[orange]%}%n%{$reset_color%}@%{$reset_color%}%{$fg_bold[red]%}%m%{$reset_color%} ]:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info)
%{${fg[$CARETCOLOR]}%}➜ %{${reset_color}%}'
RPS1='${return_code} %D - %*'
#!/bin/local/bash
# cfan.sh
# Manaual control over fans in PfSense (FreeBSD) on a Dell PowerEdge R210 ii system
# Original script: https://www.garron.me/en/bits/specify-editor-crontab-file.html
# Install:
# sudo pkg install bash && sudo pkg install ipmitool
# Add ipmi_load="YES" to /boot/loader.conf
# Add this script to /usr/bin/
# Add * * * * * /usr/local/bin/bash /usr/bin/cfan.sh to cron file with sudo crontab -e
# Reboot