This file contains 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
#!/usr/bin/env bash | |
# Adapted from https://discuss.circleci.com/t/branch-not-building/30499/10 | |
# Usage: | |
# | |
# 1. set \$CIRCLE_CLI_TOKEN or set token in ~/.circle/cli.yml | |
# 2. run `./trigger-ci [[<account>] [[<oroject>] [<branch>]]]` | |
# | |
# Examples to trigger builds in different ways: | |
# | |
# trigger-ci # on the current branch |
This file contains 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
#!/usr/bin/env bash | |
case "$-" in | |
*i*) echo 'interactive' ;; | |
*) echo 'non-interactive' ;; | |
esac | |
echo "SHLVL = $SHLVL" | |
[[ -t 1 ]] && echo "tty STDOUT? : true" || echo "tty STDOUT? : false" |
This file contains 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 | |
# setup-pgpass | |
# execute (or source) this script to ensure that ~/.pgpass has the most recent credentials | |
# | |
# if ~/.pgpass.copy exists, it is used as a source; otherwise, compare against | |
# ~postgres/.pgpass, and create ~/.pgpass and ~/.pgpass.copy from | |
# ~postgres/.pgpass | |
MY_PGPASS=~/.pgpass | |
PG_PGPASS=~postgres/.pgpass |
This file contains 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
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear | |
# 3. Clear 'Processed' and 'Failed' jobs |
This file contains 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
#!/usr/bin/env ruby | |
# migrations insert VERSION | |
# migrations remove VERSION | |
# migrations check VERSION [VERSION2] | |
# migrations match VER_PATTERN | |
# migrations names NAME_PATTERN | |
# migrations status [ up | down ] | |
# | |
# NOTE: This script relies on 'psql` to access and query the database, which means that DB access can be | |
# configured entirely with PGUSER, PGHOST, PGDATABASE, and PGPORT. |
This file contains 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
-- create a read-only user | |
create role procore_ro; | |
-- allow the RO user to use the public schema | |
grant usage on schema public to procore_ro; | |
-- grant RO access on existing tables | |
grant select on all tables in schema public to procore_ro; | |
-- grant RO access on future tables |
This file contains 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
CREATE VIEW lock_monitor AS( | |
SELECT COALESCE(blockingl.relation::regclass::text,blockingl.locktype) AS locked_item | |
, now() - blockeda.query_start AS waiting_duration | |
, blockeda.pid AS blocked_pid | |
, blockeda.query AS blocked_query | |
, blockedl.mode AS blocked_mode | |
, blockinga.pid AS blocking_pid | |
, blockinga.query AS blocking_query | |
, blockingl.mode AS blocking_mode | |
FROM pg_catalog.pg_locks blockedl |
This file contains 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
-- quickly select the estimated row counts, using reltuples, across all tables | |
-- sort the results by descending size, and table names alphabetically | |
-- | |
-- This relies on the table having been recently analyzed. | |
SELECT relname as "Table" | |
, to_char(reltuples::bigint, '9,999,999,999,999') AS "~Rows" | |
FROM pg_class | |
WHERE relname NOT LIKE 'pg%' | |
AND relkind = 'r' | |
ORDER BY 2 DESC, 1; |
This file contains 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/sh | |
# dtree DIR | |
# | |
ls -R $* | grep ':$' | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' | |
exit |
This file contains 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
#!/usr/bin/env bash | |
if [[ -d log ]] ; then | |
set -- log | |
while (( $# > 0 )) ; do | |
file="$1" | |
shift | |
if [[ -f $file && -s $file ]] ; then | |
case "$file" in | |
*.log|*.txt|*.lst) | |
echo " $file" |