JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
JPG:
$ brew install jpegoptim
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;
- PNG:
$ brew install optipng
$ find . -name "*.png" -exec optipng -o7 {} \;
| const fs = require('fs'); | |
| const jwt = require('jsonwebtoken'); | |
| // http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/ | |
| // use 'utf8' to get string instead of byte array (1024 bit key) | |
| var privateKEY = fs.readFileSync('./private.key', 'utf8'); // to sign JWT | |
| var publicKEY = fs.readFileSync('./public.key', 'utf8'); // to verify JWT | |
| module.exports = { | |
| sign: (payload, $Options) => { | |
| /* |
| const durations = [1000, 2000, 3000] | |
| promises = durations.map((duration) => { | |
| return timeOut(duration).catch(e => e) // Handling the error for each promise. | |
| }) | |
| Promise.all(promises) | |
| .then(response => console.log(response)) // ["Completed in 1000", "Rejected in 2000", "Completed in 3000"] | |
| .catch(error => console.log(`Error in executing ${error}`)) |
| // Async function to send mail to a list of users. | |
| const sendMailForUsers = async (users) => { | |
| const usersLength = users.length | |
| for (let i = 0; i < usersLength; i += 100) { | |
| const requests = users.slice(i, i + 100).map((user) => { // The batch size is 100. We are processing in a set of 100 users. | |
| return triggerMailForUser(user) // Async function to send the mail. | |
| .catch(e => console.log(`Error in sending email for ${user} - ${e}`)) // Catch the error if something goes wrong. So that it won't block the loop. | |
| }) | |