Skip to content

Instantly share code, notes, and snippets.

View joelmasters's full-sized avatar

Joel Masters joelmasters

View GitHub Profile
@joelmasters
joelmasters / App.js
Created November 19, 2020 04:35
Sentiment Analyzer App.js
import { useState, useEffect } from 'react';
import './App.css';
const ml5 = window.ml5;
let sentiment;
function App() {
let [text, setText] = useState('');
let [score, setScore] = useState(0);
let [modelIsReady, setModelIsReady] = useState(false);
@joelmasters
joelmasters / index.html
Created November 19, 2020 04:30
Sentiment Analyzer index
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Sentiment Analyzer"
/>

Log into EC2 instance on Amazon AWS.

Edit the /etc/nginx/nginx.conf file to add the following within the sever {} object:

gzip            on;
gzip_comp_level  4; # or whatever you want
gzip_types    text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

Then restart nginx: service nginx restart

@joelmasters
joelmasters / puppeteer_AWS_ElasticBeanstalk
Created September 16, 2018 16:47
Running puppeteer on AWS Elastic Beanstalk
Follow the instructions here:
https://mockingbot.com/posts/run-puppeteer-chrome-headless-on-ec2-amazon-linux
For a NextJS app, the node_modules folder will be in:
/var/app/current/node_modules
@joelmasters
joelmasters / next_nginx.md
Last active November 1, 2023 20:30 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt/getssl

next.js, nginx, reverse-proxy, ssl

Next.js package setup

Your server.js file should look like the following. Make sure you're serving static files!

const { createServer } = require('http');
const { parse } = require('url');
const next = require('next');