Skip to content

Instantly share code, notes, and snippets.

@squiddle
squiddle / dothething-with-transaction.bash
Created June 16, 2020 17:07
Bash script that can do a select from the DB, do something with each result, modify the DB after each result and do all this in a single transaction
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\t\n'
#
# starts a transaction and selects some data on which something has to be done and if successful recorded in the DB again
#
declare SQL_LIST_CANDIDATES
@squiddle
squiddle / index.js
Last active October 11, 2017 09:20 — forked from schnerd/index.js
index.js
const CDP = require('chrome-remote-interface');
const argv = require('minimist')(process.argv.slice(2));
const file = require('fs');
// CLI Args
const url = argv.url || 'https://www.google.com';
const format = argv.format === 'jpeg' ? 'jpeg' : 'png';
const viewportWidth = argv.viewportWidth || 1440;
const viewportHeight = argv.viewportHeight || 900;
const delay = argv.delay || 0;