Skip to content

Instantly share code, notes, and snippets.

@nanusdad
nanusdad / simple-expressjs-api-to-use-local-sendmail.md
Last active March 25, 2024 07:34
Simple ExpressJS API to use local sendmail

Simple ExpressJS API to use local sendmail

API code

const express = require('express');
const nodemailer = require('nodemailer');
const app = express();

app.use(express.json());

// Configure Nodemailer to use the local sendmail service
@nanusdad
nanusdad / setting-up-ssl-cert-with-nginx.md
Created March 14, 2024 09:05
Setting up SSL cert with nginx

Setting up SSL cert with nginx

  1. Copy the .crt file and encrypted .key file to nginx server
  2. Decrypt the .key file
openssl rsa -in encrypted.key -out decrypted.key
  1. Concatenate the .crt and and encrypted .key file
cat domain.crt encrypted.key > domain.pem
@nanusdad
nanusdad / sendmail-relay-ubuntu-2204-with-php.md
Created March 12, 2024 11:56
Setting up sendmail relay on Ubuntu 22.04 (with PHP)

Setting up sendmail relay on Ubuntu 22.04 (with PHP)

Test relay, needs host and port

One can use telnet to test; output will be similar to below. (use your email instead of joe@doe.com)

telnet 172.16.10.100 8081
Trying 172.16.10.100...
Connected to 172.16.10.100.
Escape character is '^]'.
220 mailagent.test.com ESMTP Postfix (Ubuntu)
@nanusdad
nanusdad / git_new_local_branch.md
Last active February 7, 2024 01:37
Git - create new local branch push to GitHub
@nanusdad
nanusdad / alfresco-on-docker-cheatsheet.md
Last active December 22, 2023 05:07
Alfresco on Docker cheatsheet

Alfresco on Docker cheatsheet

Create PostgreSQL dump

# find postgresql container ID
sudo  docker ps | grep postgres | awk '{ print $1 }'

# open shell on container (replace container id)
sudo docker exec -it cb96ca00911e /bin/bash
@nanusdad
nanusdad / InstallingMoodleonAWSLightSail.md
Last active December 21, 2023 16:43
Installing Moodle on AWS LightSail

Installing Moodle on AWS LightSail

Start with a new LightSail Instance running Ubuntu 20.04

  • Update
sudo apt update
  • Install Apache
sudo apt-get install apache2
@nanusdad
nanusdad / docker-behind-http-https-proxy.md
Last active December 12, 2023 06:59
Docker configuration behind HTTP or HTTPS proxy

Docker configuration behind HTTP or HTTPS proxy

Create http-proxy configuration file

sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf

Add lines similar to the ones below and save file

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:3128"
@nanusdad
nanusdad / raspberry-pi-getting-hardware-info.md
Created November 24, 2023 03:53
Raspberry Pi - Getting hardware information

Raspberry Pi - Getting hardware information

cat /proc/cpuinfo                             # CPU info
cat /sys/firmware/devicetree/model            # Model info
cat /proc/version                             # Software info
free -h                                       # RAM Details
@nanusdad
nanusdad / ffmpeg-cheat-sheet.md
Created May 20, 2021 04:25
FFMPEG cheat sheet

FFMPEG Cheat sheet

Compress MP4 files

ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4

Compressed file to better compatibility (WhatsApp)

ffmpeg -i broken.mp4 -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p working.mp4

Convert MOV to MP4