Skip to content

Instantly share code, notes, and snippets.

@djhouseknecht
djhouseknecht / generate.js
Last active March 24, 2023 14:01
Generate a string of random characters
const chars = [
'a', 'A',
'b', 'B',
'c', 'C',
'd', 'D',
'e', 'E',
'f', 'F',
'g', 'G',
'h', 'H',
'i', 'I',
@djhouseknecht
djhouseknecht / example-usage.js
Created November 2, 2022 20:51
Call bash commands from nodeJS and pipe the output to the console/terminal
// use `git-cli` to get the current commit
function getCurrentCommit () {
return shSync('git rev-parse HEAD').toString().trim() || '';
}
async function build() {
const currentCommit = getCurrentCommit();
console.log('We are at commit:', currentCommit);
console.log('Building our docker image'); // could be any other bash script/command