Skip to content

Instantly share code, notes, and snippets.

@jbmorley
Last active July 4, 2022 10:08
Show Gist options
  • Save jbmorley/bb629432401bd467a85d26cbad4c8f11 to your computer and use it in GitHub Desktop.
Save jbmorley/bb629432401bd467a85d26cbad4c8f11 to your computer and use it in GitHub Desktop.
function bash readData() {{
cat ~/data.txt
}}
function python prefixLines(prefix) {{
import sys
return [prefix + line for line in sys.argv]
}}
function javascript output() {{
process.stdin.on('data', data => {
console.log(`${data.toString()}`);
process.exit();
});
}}
readData() | prefixLines("data: ") | output()
bash {{
cat ~/data.txt
}} | python (prefix) {{
import sys
return [prefix + line for line in sys.argv]
}} | javascript {{
process.stdin.on('data', data => {
console.log(`${data.toString()}`);
process.exit();
});
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment