Skip to content

Instantly share code, notes, and snippets.

View snelson82's full-sized avatar

Stan Nelson snelson82

View GitHub Profile
-- Mixed with CASE, this will extract the float/digits in the last set of `()` in the string
CASE WHEN string_to_chop LIKE '%(%-%)%' THEN
NULL
ELSE
NULLIF (REPLACE(REPLACE(REGEXP_SUBSTR (string_to_chop, '\\([[:digit:]]+.[[:digit:]]+\\)$|\\([[:digit:]]+\\)$'), '(', ''), ')', ''), '')::float
END AS chopped_string
find . -mindepth 2 -type f -print -exec mv {} . \;
@snelson82
snelson82 / csv_progress_bar.rb
Last active June 15, 2021 15:07
Progress bar added to CSV for output while parsing
require 'progress_bar'
# Extends CSV class to include progress bar enhancement
class CSV
module ProgressBar
def progress_bar
::ProgressBar.new(@io.size, :bar, :counter, :percentage, :elapsed, :eta)
end
def each