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
SELECT datname, pid, state, query, age(clock_timestamp(), query_start) AS age | |
FROM pg_stat_activity | |
WHERE state <> 'idle' | |
AND query NOT LIKE '% FROM pg_stat_activity %' | |
ORDER BY age; |
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
SELECT | |
t.tablename, | |
indexname, | |
c.reltuples AS num_rows, | |
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size, | |
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size, | |
CASE WHEN indisunique THEN 'Y' | |
ELSE 'N' | |
END AS UNIQUE, | |
idx_scan AS number_of_scans, |
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 | |
mkdir -p /opt/bin | |
export PATH=$PATH:/opt/bin | |
cd /opt/bin | |
wget http://s.minos.io/s -O static-get | |
chmod a+rx ./static-get | |
cd /opt |
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
index 678b450ab..c2a58bd00 100644 | |
--- a/cmake/FindCUDA.cmake | |
+++ b/cmake/FindCUDA.cmake | |
@@ -283,7 +283,38 @@ | |
# CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core). | |
# Only available for CUDA version 5.5+. | |
# CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing). | |
-# Only available for CUDA version 5.5+. | |
+# Only available for CUDA version 5.5+ and was split up | |
+# in CUDA version 8.0+ and doesn't exist in combined |
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 | |
# Usage | |
# ./abort-all-orphaned-multipart-uploads.sh [profile] | |
# | |
# Requirements | |
# jq | |
# awscli | |
profile=$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
-- Courtesy | |
-- http://shuber.io/porting-activerecord-counter-cache-behavior-to-postgres/ | |
CREATE FUNCTION increment_counter(table_name text, column_name text, id integer, step integer) | |
RETURNS VOID AS $$ | |
DECLARE | |
table_name text := quote_ident(table_name); | |
column_name text := quote_ident(column_name); | |
conditions text := ' WHERE id = $1'; | |
updates text := column_name || '=' || column_name || '+' || step; |
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 EXTENSION pg_buffercache; | |
SELECT c.relname, | |
pg_size_pretty(count(*) * 8192) as buffered, round(100.0 * count(*) / (SELECT setting FROM pg_settings WHERE name='shared_buffers')::integer,1) AS buffers_percent, | |
round(100.0 * count(*) * 8192 / pg_relation_size(c.oid),1) AS percent_of_relation, | |
round(100.0 * count(*) * 8192 / pg_table_size(c.oid),1) AS percent_of_table | |
FROM pg_class c | |
INNER JOIN pg_buffercache b | |
ON b.relfilenode = c.relfilenode | |
INNER JOIN pg_database d |
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 | |
# Example from http://bazaar.launchpad.net/~rladams/+junk/LedgerInvoicingExample/view/head:/CreateInvoice.sh | |
# Pass the invoice # as the first and only argument | |
[ -n "$1" ] || { echo 'Specify an invoice number.' ; exit -1 ; } | |
# Load config file to override defaults | |
CUSTOMIZATION_FILE="~/.`basename \"${0}\" .sh`.rc" | |
[ -f "${CUSTOMIZATION_FILE}" ] && . "${CUSTOMIZATION_FILE}" |
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
// Test for now - eventually use this to continue | |
const mutationObserver = new MutationObserver(mutations => { | |
mutations.forEach(mutation => { | |
console.debug(mutation) | |
}) | |
}) | |
mutationObserver.observe(elementToWatch, { | |
attributes: true, | |
characterData: true, |
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 | |
[ -z "$3" ] && echo "Usage: $0 host user password" >&2 && exit 1 | |
dt="tmp_$RANDOM$RANDOM" | |
mysql -h $1 -u $2 -p$3 -ABNe "create database $dt;" | |
[ $? -ne 0 ] && echo "Error: $0 terminating" >&2 exit 1 | |
echo |