Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ "$1" ]
then
find "$1" -name '*.flac' | while read fn;
do
basename=$(basename "$fn" .flac).mp3
dirname=$(dirname "$fn")
outfile="$dirname/$basename"
#!/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 / 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
###############################################################################
@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 #
# #
@ssstonebraker
ssstonebraker / ipinfo.sh
Created April 26, 2018 06:14
Determine Country Code for a List of IP Addresses
#!/bin/bash
# Usage: ./ipinfo.sh file_containing_one_ip_per_line
filename=$1
ipAddresses=`cat $filename`
`echo "" > out.txt` #To empty the file
readonly ourPath="$(dirname $0)"
@ssstonebraker
ssstonebraker / showdupes.sh
Last active December 15, 2018 07:22
Linux dedupe compare files
#!/bin/bash
# Filename: showdupes.sh
# source: http://brakertech.com/compare-two-files-and-print-lines-that-match/
# this file takes two text files as input
# sorts them and outputs lines from
# file 2 that match file 1
if [ -f "$1" ] && [ -f "$2" ]
then
awk 'NR==FNR{arr[$0];next} $0 in arr' $1.tmp $2.tmp;