This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // node pass-the-fun-node-v14-and-under.js inputfile | |
| // this will create a clone of inputfile with inputfile.bak | |
| // and count the bytes written using stream.PassThrough | |
| // note the simplified contructor form (as illustrated in | |
| // pass-the-fun-node-v15.js does not work as expected in | |
| // node v14 | |
| const fs = require('fs') | |
| const { pipeline, PassThrough } = require('stream') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Hapi = require('@hapi/hapi') | |
| ;(async () => { | |
| const server = Hapi.server({ | |
| port: 3000 | |
| }) | |
| server.events.on('log', logObject => { | |
| console.log(JSON.stringify(logObject)) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // main.rs | |
| use std::env; | |
| use std::error::Error; | |
| use std::fs; | |
| use std::fmt; | |
| #[derive(Debug)] | |
| struct MyError(String); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RUST_TARGET="aarch64-unknown-linux-gnu" | |
| RUST_VERSION="latest" | |
| PROJECT_NAME=${PWD##*/} | |
| zipRustLambda() { | |
| cp ./target/${RUST_TARGET}/release/${PROJECT_NAME} ./bootstrap && zip lambda.zip bootstrap && rm bootstrap | |
| } | |
| al2build() { | |
| cross build --release --target ${RUST_TARGET} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function aws_translate($text, $sourceLang = 'zh-TW', $targetLang = 'en') | |
| { | |
| $aws_access_key_id = 'key_id'; | |
| $aws_secret_access_key = 'key'; | |
| // AWS region and Host Name (Host names are different for each AWS region) | |
| // As an example these are set to us-east-1 (US Standard) | |
| $aws_region = 'us-east-1'; | |
| $host_name = 'translate.us-east-1.amazonaws.com'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const pino = require('pino') | |
| const pkafka = require('pino-kafka') | |
| // this can be from .env, via JSON.parse | |
| const kafkaLogConfig = { | |
| "clientId":"some-producer1", | |
| "defaultTopic": "some-log-topic", | |
| "brokers":["some-host:9092"] | |
| } | |
| const streams = [{ stream: process.stdout, level: 'info' }] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Enable vi editing mode | |
| set editing-mode vi | |
| # Show the mode indicator in the prompt (requires Bash >= 4.3) | |
| set show-mode-in-prompt on | |
| # Customize the indicator strings (optional) | |
| # The \1 and \2 wrap non-printable characters (like color codes) | |
| set vi-ins-mode-string "(ins) " | |
| set vi-cmd-mode-string "(cmd) " |
OlderNewer