npm iUse this docker image to setup the scanner
docker run --name clamav -d -p 3310:3310 mkodockx/docker-clamav| 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' }] |
| <?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'; |
| 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} |
| // main.rs | |
| use std::env; | |
| use std::error::Error; | |
| use std::fs; | |
| use std::fmt; | |
| #[derive(Debug)] | |
| struct MyError(String); |
| const Hapi = require('@hapi/hapi') | |
| ;(async () => { | |
| const server = Hapi.server({ | |
| port: 3000 | |
| }) | |
| server.events.on('log', logObject => { | |
| console.log(JSON.stringify(logObject)) | |
| }) |
| // 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') |
| SFTP_USER= | |
| SFTP_HOST=127.0.0.1 | |
| SFTP_PORT=22 | |
| SFTP_PASSWORD= |
| const Hapi = require('@hapi/hapi') | |
| const Joi = require('@hapi/joi') | |
| const fileType = require('file-type') | |
| const stream = require('stream') | |
| const Readable = stream.Readable | |
| const port = 5000 | |
| const server = Hapi.server({ | |
| port | |
| }) |
| const faker = require('faker') | |
| // const N = 30 | |
| const N = 2000000 | |
| const fs = require('fs') | |
| const record = () => { | |
| // faker.fake( | |
| // '{{name.lastName}},{{name.lastName}},{{address.city}},{{address.county}},{{address.zipCode}},{{hacker.adjective}}\n' | |
| return [ | |
| faker.name.firstName(), | |
| faker.name.lastName(), |