Skip to content

Instantly share code, notes, and snippets.

View jperasmus's full-sized avatar
🔥
Too blessed to be stressed

JP Erasmus jperasmus

🔥
Too blessed to be stressed
View GitHub Profile
@jperasmus
jperasmus / compose.js
Last active June 30, 2022 07:48
"compose" function that handles both sync and async functions
// Async compose
const compose = (…functions) => input => functions.reduceRight((chain, func) => chain.then(func), Promise.resolve(input));
// Functions fn1, fn2, fn3 can be standard synchronous functions or return a Promise
compose(fn3, fn2, fn1)(input).then(result => console.log(`Do with the ${result} as you please`))

###SSH into a remote machine###

ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1

exit: exit ###Install Something###

#If it's a new server, update apt-get first thing