Compare commits
2 Commits
2d1e6a0c22
...
chromebook
| Author | SHA1 | Date | |
|---|---|---|---|
| 9893d3f362 | |||
| e8ae4e6c29 |
@@ -28,9 +28,32 @@ alias extip='curl -s -4 icanhazip.com'
|
|||||||
# Memory Pigs (top 10)
|
# Memory Pigs (top 10)
|
||||||
alias mempigs='ps aux | awk '\''{print $6/1024 " MB\t\t" $11 " " $12}'\'' | sort -n | tail -10'
|
alias mempigs='ps aux | awk '\''{print $6/1024 " MB\t\t" $11 " " $12}'\'' | sort -n | tail -10'
|
||||||
|
|
||||||
|
# dir -v (part of pushd/popd)
|
||||||
|
alias dir='dir -v'
|
||||||
|
|
||||||
# send things to termpad
|
# send things to termpad
|
||||||
# with httpie
|
# with httpie
|
||||||
alias tph=' http https://termpad.planethawleywood.com'
|
alias tph=' http https://termpad.planethawleywood.com'
|
||||||
# with cURL
|
# with cURL
|
||||||
alias tpc=' curl --data-binary @- https://termpad.planethawleywood.com'
|
alias tpc=' curl --data-binary @- https://termpad.planethawleywood.com'
|
||||||
|
|
||||||
|
|
||||||
|
# Do lots of things with FZF
|
||||||
|
|
||||||
|
# CD with the help of fzf
|
||||||
|
alias cdf='cd ~ && cd "$(find . -type d -print0 | fzf --read0 --print0)"'
|
||||||
|
|
||||||
|
# VIM
|
||||||
|
alias vimf='vim "`fzf`"'
|
||||||
|
|
||||||
|
# LESS
|
||||||
|
alias lessf='less "`fzf`"'
|
||||||
|
|
||||||
|
# CAT
|
||||||
|
alias catf='cat "`fzf`"'
|
||||||
|
|
||||||
|
# GLOW
|
||||||
|
alias glowf='glow "`fzf`"'
|
||||||
|
|
||||||
|
# VS Code on the Chromebook
|
||||||
|
alias code='code --password-store="gnome-libsecret"'
|
||||||
|
|||||||
@@ -1,5 +1,85 @@
|
|||||||
# Shell Functions
|
# Shell Functions
|
||||||
|
|
||||||
|
# Shell note pad for Bash
|
||||||
|
noteb () {
|
||||||
|
local notes_file="$HOME/.notes"
|
||||||
|
local timestamp=$(date +"%F %T")
|
||||||
|
local input_line
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
# No arguments, display the notes file
|
||||||
|
tac "$notes_file"
|
||||||
|
return 0
|
||||||
|
elif [[ "$1" == "-a" ]]; then
|
||||||
|
# Add a note with prompting (using Bash's read -p)
|
||||||
|
read -r -p "$(date +"%F %T | ") " input_line
|
||||||
|
if [[ -n "$input_line" ]]; then
|
||||||
|
echo "$timestamp | $input_line" >> "$notes_file"
|
||||||
|
echo "Note added to $notes_file"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "No note entered."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
elif [[ "$1" == "-c" ]]; then
|
||||||
|
# Clear the notes file
|
||||||
|
read -r -p "Clear notes file? [Y/n] " clear_response
|
||||||
|
if [[ "$clear_response" =~ ^[Yy]$ ]]; then
|
||||||
|
> "$notes_file" # Truncate the file
|
||||||
|
echo "Notes file cleared."
|
||||||
|
else
|
||||||
|
echo "Notes file not cleared."
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# Treat arguments as the note (default action if not -a or -c)
|
||||||
|
input_line="$*"
|
||||||
|
echo "$timestamp | $input_line" >> "$notes_file"
|
||||||
|
echo "Note added to $notes_file"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Shell Note Pad for ZSH
|
||||||
|
notez () {
|
||||||
|
local notes_file="$HOME/.notes"
|
||||||
|
local timestamp=$(date +"%F %T")
|
||||||
|
local input_line
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
# No arguments, display the notes file
|
||||||
|
tac "$notes_file"
|
||||||
|
return 0
|
||||||
|
elif [[ "$1" == "-a" ]]; then
|
||||||
|
# Add a note with prompting
|
||||||
|
read -r "?$(date +"%F %T | ") " input_line
|
||||||
|
if [[ -n "$input_line" ]]; then
|
||||||
|
echo "$timestamp | $input_line" >> "$notes_file"
|
||||||
|
echo "Note added to $notes_file"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "No note entered."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
elif [[ "$1" == "-c" ]]; then
|
||||||
|
# Clear the notes file
|
||||||
|
read -r "?Clear notes file? [Y/n] " clear_response
|
||||||
|
if [[ "$clear_response" =~ ^[Yy]$ ]]; then
|
||||||
|
> "$notes_file" # Truncate the file
|
||||||
|
echo "Notes file cleared."
|
||||||
|
else
|
||||||
|
echo "Notes file not cleared."
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
# Treat arguments as the note (default action if not -a or -c)
|
||||||
|
input_line="$*"
|
||||||
|
echo "$timestamp | $input_line" >> "$notes_file"
|
||||||
|
echo "Note added to $notes_file"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# tar/gzip a directory
|
# tar/gzip a directory
|
||||||
# I use this before 'rm -rf'ing a directory I think is useless
|
# I use this before 'rm -rf'ing a directory I think is useless
|
||||||
# if nothing breaks after a predetermined amount of time, then the tar file is safe to delete
|
# if nothing breaks after a predetermined amount of time, then the tar file is safe to delete
|
||||||
|
|||||||
Reference in New Issue
Block a user