Skip to content

Instantly share code, notes, and snippets.

diff --git a/lib/dialects/postgres/index.js b/lib/dialects/postgres/index.js
index 7a719f21..ab4ca982 100644
--- a/lib/dialects/postgres/index.js
+++ b/lib/dialects/postgres/index.js
@@ -47,6 +47,10 @@ Object.assign(Client_PG.prototype, {
driverName: 'pg',
_driver() {
+ if (process.env.KNEX_POSTGRES_DRIVER === 'pg-native') {
+ return require('pg').native;
import { createHash } from "crypto";
import BluebirdPromise from "bluebird";
import Client_PG from "knex/lib/dialects/postgres";
function hash(str) {
return createHash("sha1")
.update(str)
.digest("hex");
}
@netproteus
netproteus / logs.sh
Last active June 19, 2020 23:30
Tail a kinesis stream in your account called `ecs-log-stream` to a console - assumes only 1 shard
#!/bin/bash
SERVICE="$1"
SHARD_ITERATOR=$(aws kinesis get-shard-iterator --shard-id shardId-000000000000 --shard-iterator-type LATEST --stream-name ecs-log-stream --query 'ShardIterator')
LOOP=true
trap "LOOP=false" SIGHUP SIGINT SIGTERM
while [ "${LOOP}" == "true" ]; do
@netproteus
netproteus / aws-vault-exec.sh
Created June 19, 2020 23:26
Run command with aws-vault that will refresh after timeout
#!/bin/bash
set -e
# This can be between 900 (15m) and 3600 (1h)
TIMEOUT=3600
START_TIME=$(date +%s)
function close_sub_task() {
# First we strip off the outer policy to get left with single list of statements
[
map( .Statement ) |
.[] | .[]
] |
# Then we want to normalise so that all actions and resources are arrays and sorted
map(
. as $original_statement |
# Do some checking to make sure elements that haven't been considered aren't in any statements
# They probably could be supported in similar way to Effect and Condition below
#!/bin/bash
if [ -z "$1" ]
then
echo "no file"
exit 1
fi
OUTPUT="$(echo "$1" | perl -pe 's/^(.*)\.mkv/\1/g').mp4"
@netproteus
netproteus / requirements.txt
Created July 9, 2018 00:47 — forked from jarpy/requirements.txt
Serverless Elasticsearch Curator for AWS Lambda
certifi==2016.8.8
elasticsearch-curator==4.0.6
PyYAML==3.11

Keybase proof

I hereby claim:

  • I am netproteus on github.
  • I am netproteus (https://keybase.io/netproteus) on keybase.
  • I have a public key ASD4uzI4T1uexbaHComZH2dDlQnz8sQE3sS9U2Y6XkA8WAo

To claim this, I am signing this object:

@netproteus
netproteus / YubiKey-GPG-SSH-guide.md
Created April 15, 2018 14:08 — forked from ageis/YubiKey-GPG-SSH-guide.md
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate).

@netproteus
netproteus / YubiKey-GPG-SSH-guide.md
Created April 15, 2018 14:08 — forked from ageis/YubiKey-GPG-SSH-guide.md
Technical guide for using YubiKey series 4 for GPG and SSH

YubiKey 4 series GPG and SSH setup guide

Written for fairly adept technical users, preferably of Debian GNU/Linux, not for absolute beginners.

You'll probably be working with a single smartcard, so you'll want only one primary key (1. Sign & Certify) and two associated subkeys (2. Encrypt, 3. Authenticate).