Skip to content

Instantly share code, notes, and snippets.

View justinpage's full-sized avatar

Justin Page justinpage

View GitHub Profile
#!/bin/bash
ffmpeg -loop 1 -y -i example.jpg -i example.mp3 -shortest -pix_fmt yuv420p example.mp4
const { performance } = require('node:perf_hooks');
function fib1(n) {
let s = [0, 1, 1];
for (let i = 3; i <= n; i++) {
s.push(s[s.length - 1] + s[s.length - 2])
}
return s[s.length - 1]

Family loves playing the following game:

scramble

While I was visiting them it go me thinking that you could use the command lines built in dictionary.

And by using that you can use your trusty grep to find matches

export function sumSalaries(salaries) {
let sum = 0;
for (const salary of Object.values(salaries)) {
sum += salary;
}
return sum;
}
export function count(user) {
return Object.keys(user).length
docker-compose exec -T mongo mongoimport "mongodb://0.0.0.0:27017" --username root --password secret --authenticationDatabase admin -d movieData -c movies --jsonArray --drop < ~/Downloads/tv-shows.json > output.json

Creating an example AWS photo analyzer application using the AWS SDK for JavaScript (v3)

Purpose

The cross-service example demonstrates how to build an app that analyzes nature images located in an Amazon Simple Storage Service (Amazon S3) bucket by using the AWS Rekognition service. For example, the following image shows a lake.

AWS Photo Analyzer

After the application analyzes this image, it creates this data:

  • Panoramic - 99.99971
// If there is no break then the execution
// continues with the next case without any checks
// This might be an interesting way to stagger actions
//
// Clever, but maybe would be too unreadable
let a = 2 + 2;
switch (a) {
case 3:
console.log( 'Too small' );
version: '3.7'
services:
mongo:
image: mongo:5.0.5
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=secret
volumes:
- mongo_data:/data/db
const logger = require('pino')({
timestamp: () => `,"time":"${new Date().toISOString()}"`
})
const LIMIT = 5
let c = {uuid: '6d20a81a-28f9-4fb7-8ee8-2f742bc6d9a2'}
let e = {msg: `Timeout: failed to get response in ${LIMIT} seconds`}
logger.error({cxt: c, err: e}, 'getImages: Failed to get images from API')