CCCPaste

Pull all Base64 jpg/jpeg images from a HAR file

#!/bin/bash
#pull all jpg/jpegs from a HAR file
let x=100
grep -A 1 '"mimeType": "image/jpeg"' archive.org.har|\
grep "text"|\

Bash trim string function

################################################################################
# Function: trim
# Description: Trims any/all whitespace from the beginning and end of a string
# Arguments: $1 :- The string from which to trim whitespace
# Outputs: Prints string with any leading/trailing whitespace removed

Bash create temporary directory function

################################################################################
# Function: create_temp_dir
# Description: Creates a temporary directory
# Arguments: $1 :- temporary directory name prefix (required)
# Outputs: Prints name of the created temporary directory

Bash echo if verbose function

################################################################################
# Function: echo_if_verbose
# Description: Prints $@ if IS_VERBOSE is not empty
# Arguments: $@ :- Content to echo if ${IS_VERBOSE} is not empty
# Requires: ${IS_VERBOSE} set to a non-empty string if verbose is on

Bash function to display usage and exit

################################################################################
# Function: usage_exit
# Description: Prints the usage message for this script and then exits
# Arguments: $1 :- Exit code; defaults to 1
# Outputs: Prints description of how to call this script

Bash function to remove slash from end of string

################################################################################
# Function: chomp_slash
# Description: Removes any trailing slash ("/") from a string
# Arguments: $1 :- String from which to remove any trailing slashes
# Ouputs: Prints string with trailing slashes removed

Bash create temporary file function

################################################################################
# Function: create_temp_file
# Description: Creates a temporary file
# Arguments: $1 :- temporary directory name (required)
# Outputs: Prints name of the created temporary directory

BASH Fallback to default variable

#!/bin/bash

#set candy to first argument
#default to Twix is none are given
#candy="${@:-Twix}" #for all arguments

BASH Shift through Arguments

#!/bin/bash

#check for argument
if [ $# -lt 1 ]; then
echo "Usage: $0 name(s)"

Fix MySQL PHPmyAdmin problems - notes

#purge all mysql
sudo apt purge $(aptitude search mysql|grep ^i|sed 's/ A/ /g'|awk '{print $2}'|tr "\n" " ")

#purge all php
sudo apt purge $(aptitude search php|grep ^i|sed 's/ A/ /g'|awk '{print $2}'|tr "\n" " ")