Install gm
and pngquant
.
apt-get install gm pngquant
Generate a thumbnail.
You can replace -thumbnail
with -resize
for a clearer thumbnail that will result in a larger file size.
// Photoshop Script for Optimizing Images for the Web - Saves images as optimized jpeg | |
// Written by: Livingston Samuel | |
// Version 1.0.0 | |
// Required Adobe Photoshop CS 2 and above | |
//Enable double clicking on Mac Finder & Windows Explorer | |
#target Photoshop | |
//Bring app to front | |
app.bringToFront() |
#!/usr/bin/env node | |
var Q = require('q'), | |
FS = require('fs'), | |
PB = require('progress'), | |
AWS = require('aws-sdk'), | |
conf = new require('../config')(); | |
AWS.config.update(conf.aws_credentials); |
function download(fileUrl, apiPath, callback) { | |
var url = require('url'), | |
http = require('http'), | |
p = url.parse(fileUrl), | |
timeout = 10000; | |
var file = fs.createWriteStream(apiPath); | |
var timeout_wrapper = function( req ) { | |
return function() { |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
## Global install of the app generator | |
npm install -g create-react-app | |
## Setup the app (first-time only) | |
create-react-app my-app | |
cd my-app | |
git init | |
# Create the Heroku app; requires free account at https://www.heroku.com/ | |
heroku create -b https://github.com/heroku/heroku-buildpack-static.git |
Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex
command line tool.
To learn more about migrations, check out this article on the different types of database migrations!
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime | |
# As of Dec 6, 2018, this is Amazon Linux AMI – amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2 | |
# Check latest from here: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html | |
# SSH to Amazon Linux AMI instance, that you just created: | |
ssh -i ${EC2_KEY} ${EC2_USERNAME}@${EC2_IP} | |
sudo yum -y install libpng-devel libjpeg-devel libtiff-devel gcc | |
# GraphicsMagick download latest stable as of Dec 6, 2018, this is 1.3.31 (latest stable) | |
curl -O https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/1.3.31/GraphicsMagick-1.3.31.tar.gz |
var express = require('express') | |
var session = require('express-session') | |
var app = express() | |
var r = require('request') | |
// By default cookies are disabled, switch it on | |
var request = r.defaults( { jar:true } ) | |
app.use(session({ secret: 'keyboard cat',saveUninitialized : false, resave : false, cookie: { maxAge: 60000 }})) |