This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log() { | |
while IFS= read -r line; do | |
# prepend timestamp, first argument/second argument, and then input line | |
echo "[$(date -u +'%Y-%m-%d %H:%M:%S,%3N') $1/$2] $line" | |
done | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo '' && echo 'Please also provide server name as in config file...' && | |
exit 1 | |
fi | |
retries=0 | |
repeat=true | |
today=$(date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- reference: https://github.com/datachomp/dotfiles/blob/master/.psqlrc | |
\set QUIET 1 | |
-- formatting | |
\x auto | |
\set VERBOSITY verbose | |
\set ON_ERROR_ROLLBACK interactive | |
-- show execution times | |
\timing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Manifest < ApplicationRecord | |
def self.item_ids(id, keyword=nil, prefix=nil) | |
cases = Arel::Table.new(:manifest_items) | |
casequery = cases.where(cases[:manifest_id].eq(id)) | |
if keyword | |
# "keywords" is an string array column in the database, so I want to generate | |
# "'#{keyword}' = ANY(keywords)", essentially, with correct quoting/escaping |
OlderNewer