Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 1.48 KB

LIBRARY.md

File metadata and controls

71 lines (48 loc) · 1.48 KB

library

A useful library of various scripts that can be ran with the runbook CLI.

Make your own library by installing runbook and writing your first runnable markdown file!

networking

Which process is using a specific port?

lsof -i tcp:{{ port }}

encoding

Encoding a string to a base64 string

console.log(Buffer.from('{{ input }}', 'utf8').toString('base64'))

Decoding a base64 string to the original string

console.log(Buffer.from('{{ input }}', 'base64').toString('utf8'))

security

Generate a random password

runbook run generate password --length 20
const { randomFillSync } = require('crypto')

const generatePassword = (
  length = {{ length }},
  wishlist = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$'
) => Array
  .from(randomFillSync(new Uint32Array(length)))
  .map(x => wishlist[x % wishlist.length])
  .join('')

console.log(generatePassword())

fun

Runbook logo party

runbook run print runbook logo --times 3

Prints the runbook logo X times to the terminal.

import terminal from './src/features/terminal'

function print (times: number) {
  for (let i = 0; i < times; i++) {
    console.log(terminal.ascii.art.logo)
  }
}

print({{ times }})