Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
@jhyland87
jhyland87 / ps.txt
Created March 2, 2017 20:16
PS man page from OSX
PS(1) BSD General Commands Manual PS(1)
NAME
ps -- process status
SYNOPSIS
ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u uid[,uid...]] [-p pid[,pid...]]
[-t tty[,tty...]] [-U user[,user...]]
@jhyland87
jhyland87 / youtube-dl_template-values.list
Created October 5, 2018 21:14
Template values for the youtube-dl command
General
id (string) Video identifier
title (string) Video title
url (string) Video URL
ext (string) Video filename extension
alt_title (string) A secondary title of the video
display_id (string) An alternative identifier for the video
uploader (string) Full name of the video uploader
license (string) License name the video is licensed under
creator (string) The creator of the video
All files were found via Googling:
site:oregontechsfcdn.azureedge.net filetype:pdf inurl:library-documents
or for specific chapters:
site:oregontechsfcdn.azureedge.net filetype:pdf inurl:library-documents inurl:chapter-1
#https://www.google.com/search?q=site%3Aoregontechsfcdn.azureedge.net+inurl%3Alibrary-documents+filetype%3Apdf
Successful Searching in Oregon Tech Library’s Electronic Resources
https://oregontechsfcdn.azureedge.net/oregontech/library-documents/successful-searching-in-oregon-tech-library-electronic-resources2012.pdf
function __trim {
if test -p /dev/stdin; then
data="$(</dev/stdin)"
elif test -n "${1}"; then
data="$*"
else
return 1
fi
echo "${data}" | sed -E -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g'
@jhyland87
jhyland87 / ps1.sh
Created May 22, 2018 21:36
Prompt script function - Should be saved to /etc/profile.d/ps1.sh
#!/bin/bash
# Create /etc/profile.d/prompt.sh and add the content of this gist to it.
#
# Prompt example:
# (2)[Fri May 06 10:00:30| 0:003]{4}root@ip-172-31-1-226:~(0)#
# Format is:
# (sessions on server)[date time| Last command exec time]{sessions on server}username@hostname:working_directory(exit code of last cmd)#
#
# Example Output (of $[prompt[0]}): http://d.pr/i/19B87
#
@jhyland87
jhyland87 / bash_input.sh
Last active September 29, 2022 00:42
Example of a function that accepts input from stdin or as arguments
function trim {
if [ $# -eq 0 ]
then
data=$(cat)
else
data="$*"
fi
data="${data#"${data%%[![:space:]]*}"}"
data="${data%"${data##*[![:space:]]}"}"
@jhyland87
jhyland87 / colors.sh
Last active September 29, 2022 00:41
declare -A _c
_c[reset]=$(tput sgr0)
_c[bold]=$(tput bold)
_c[red]=$(tput setaf 1)
_c[grn]=$(tput setaf 2)
_c[yel]=$(tput setaf 3)
_c[cya]=$(tput setaf 6)
function _err {
echo "${1}" 1>&2
[[ -n $2 ]] && exit $2
}
function trim {
if test -p /dev/stdin; then
data="$(</dev/stdin)"
@jhyland87
jhyland87 / prompt.sh
Last active September 29, 2022 00:41
Awesome profile.d bash script for a useful PS1
#!/bin/bash
# Create /etc/profile.d/prompt.sh and add the content of this gist to it.
#
# Prompt example:
# (2)[Fri May 06 10:00:30| 0:003]{4}root@ip-172-31-1-226:~(0)#
# Format is:
# (sessions on server)[date time| Last command exec time]{sessions on server}username@hostname:working_directory(exit code of last cmd)#
#
# Example Output (of $[prompt[0]}): http://d.pr/i/19B87
#
#!/usr/local/bin/bash4
function stderr {
echo $@ 1>&2
}
function abspath {
[[ -d $1 ]] && { cd "$1"; echo "$(pwd -P)"; } ||
{ cd "$(dirname "$1")"; echo "$(pwd -P)/$(basename "$1")"; }
}