Skip to content

Instantly share code, notes, and snippets.

@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
#!/bin/bash
#From http://brakertech.com/linux-find-large-files/
# find large files
echo "find files over 100MB"
find / -type f -size +100000k -exec ls -lh {} \;
@ssstonebraker
ssstonebraker / color chkconfig
Created August 29, 2013 16:02
generic bash aliases
#From http://unix.stackexchange.com/questions/88702/change-chkconfig-used-by-centos-6-3-to-print-on-in-bright-green-like-ubuntus/88706#88706
alias chkconfig="chkconfig | perl -pe 'use Term::ANSIColor; s/\bon\b/color(\"green\").on.color(\"reset\")/ige;'"
@ssstonebraker
ssstonebraker / install_audit_console.sh
Created September 3, 2013 13:13
Function to install AuditConsole
#!/bin/bash
####################################
# Exit if program echo does not exist (this allows us to do one line if statements)
[ ! -x "$(which echo)" ] && exit 1
########################################
# pretty printing functions
function print_status { echo -e "\x1B[01;34m[*]\x1B[0m $1"; }
function print_good { echo -e "\x1B[01;32m[*]\x1B[0m $1"; }
@ssstonebraker
ssstonebraker / jks_generation.sh
Created September 20, 2013 06:35
generate tomcat jks
#!/bin/bash
###############################################################################
# USAGE: idc-certadd
#
# Allows user to:
# 1. Create a new certificate to be kept in OSCARS.jks
# 2. Import a signed certificate into OSCARS.jks
# 3. Import a trusted certificate into OSCARS.jks or ssl-keystore.jks
###############################################################################
#!/bin/sh
if [ "$1" ]
then
find "$1" -name '*.flac' | while read fn;
do
basename=$(basename "$fn" .flac).mp3
dirname=$(dirname "$fn")
outfile="$dirname/$basename"
@ssstonebraker
ssstonebraker / get_amis.sh
Created January 17, 2018 20:53
Get all ami's in use on and aws account
#!/bin/bash
# get_amis.sh
# Return a list of all ami's in use in aws
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[ImageId,Tags[*]]' | grep ami | perl -pi -e "s/,//g;" | perl -pi -e "s/\"//g;" | perl -pi -e "s/\s+/\n/g;" | grep -v "^$"
@ssstonebraker
ssstonebraker / ediscovery_search_exported_msg_files.ps1
Created February 8, 2018 08:19
Search exported ediscovery msg files from exchange compliance center for a string
# ediscovery_search_exported_msg_files.ps1
# Search through exported .msg files from content search (exchange compliance center) and return a spreadsheet of email addresses and matched URLs
# Kill outlook
cmd.exe /c "taskkill /F /IM outlook.exe /T 2> nul"
$scriptPath = $(split-path $myinvocation.mycommand.definition)
$inputPath = "$($scriptPath)\inputMails"
# Find all .msg files recursively
@ssstonebraker
ssstonebraker / natophon.sh
Created February 22, 2018 21:25 — forked from bradland/natophon.sh
NATO phonetic string converter for bash
#!/bin/bash
#########################################################################
# #
# #
# NATO String converter #
# #
# Description: converts string (first parameter given) #
# to NATO phonetics-alphabet #
# #