Skip to content

Instantly share code, notes, and snippets.

View unabridgedxcrpt's full-sized avatar

Jonathan Bird unabridgedxcrpt

View GitHub Profile
@unabridgedxcrpt
unabridgedxcrpt / sed cheatsheet
Last active December 9, 2017 06:11 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
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'
@unabridgedxcrpt
unabridgedxcrpt / BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
Last active June 28, 2019 21:27 — forked from ccstone/BBEdit-TextWrangler_RegEx_Cheat_Sheet.txt
BBEdit-TextWrangler Regular Expression Cheat-Sheet
————————————————————————————————————————————————————————————————————————————————————————————————————
BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@unabridgedxcrpt
unabridgedxcrpt / xfer-wowza-logs.sh
Last active February 1, 2018 19:21 — forked from tingletech/gist:3995384
calculate transfer out from wowza logs
# To calculate the bandwidth usage per session, subtract sc-bytes in the “connect” event by sc-bytes in the “disconnect” event
connect=`grep $'\tconnect' wowzastreamingengine_access.log.????-??-?? | cut -f22 | awk '{total = total + $1}END{print total}' `
disconnect=`grep $'\tdisconnect' wowzastreamingengine_access.log.????-??-?? | cut -f22 | awk '{total = total + $1}END{print total}' `
SESSION=`expr $connect - $disconnect`
echo -e "Bandwidth usage per session, subtract sc-bytes in the *connect* event by sc-bytes in the *disconnect* event\n"
echo -e " $SESSION bytes"
# To calculate the bandwidth usage per stream, subtract sc-stream-bytes in the “play” event from sc-stream-bytes in the “stop” event.
play=`grep $'\tplay' wowzastreamingengine_access.log.????-??-?? | cut -f27 | awk '{total = total + $1}END{print total}' `
stops=`grep $'\tstop' wowzastreamingengine_access.log.????-??-?? | cut -f27 | awk '{total = total + $1}END{print total}' `
@unabridgedxcrpt
unabridgedxcrpt / Batch conversion script
Last active February 11, 2016 20:54 — forked from steventrux/Chromecast batch conversion script
A bash script to batch convert video files for chromecast compatibility
#! /bin/bash
# Batch Convert Script by StevenTrux
# The Purpose of this Script is to batch convert any video file to mp4 or mkv format for chromecast compatibility
# this script only convert necessary tracks if the video is already
# in H.264 format it won't convert it saving your time!
# Put all video files need to be converted in a folder!
# the name of files must not have " " Space!
# Rename the File if contain space
@unabridgedxcrpt
unabridgedxcrpt / WP from Dev to Prod
Last active January 25, 2016 17:53 — forked from matiasmasca/WP de desarrollo a producción
Move WordPress site from Development to Production
-- Script to migrate WordPress database from development to production. Thanks Sergio A. Moreyra.
UPDATE wp_options
SET option_value = replace(option_value,'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts
SET guid = REPLACE (guid, 'http://www.TuSitio.com/desarrollo', 'http://www.TuSitio.com/');
UPDATE wp_posts
@unabridgedxcrpt
unabridgedxcrpt / build-python-2.7.9.sh
Created December 18, 2015 13:33
upgrade Python 2.7.6 -> 2.7.9 on Ubuntu 14.04
#!/bin/sh
#
# Installs Python 2.7.9 on Ubuntu 14.04 to include security updates
# Run this script with superuser privileges.
#
BASEDEPS="build-essential python-pip"
BUILDDEPS="libbz2-dev \
libc6-dev \
libgdbm-dev \
"""
You can download the flickr API by running
pip install flickrapi
Info here:
http://stuvel.eu/media/flickrapi-docs/documentation/2-calling.html
You'll need to create a Flickr API app here:

Last updated: 2015-08-11

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management