Skip to content

Instantly share code, notes, and snippets.

@nanusdad
nanusdad / first-certificate-error.md
Last active June 18, 2024 06:53
How to resolve - unable to verify the first certificate in NodeJS

How to resolve - unable to verify the first certificate in NodeJS

Connect using SSL to ascertain the error

openssl s_client -connect foo.badssl.com:443 -servername foo.badssl.com

Save output to tmp file

openssl s_client -connect foo.badssl.com:443 -servername foo.badssl.com | tee /tmp/logcertfile

Find issuer and CRT file

openssl x509 -in /tmp/logcertfile -noout -text | grep -i "issuer"

Get the intermediate certificate from issues

curl --output sectigo.crt http://crt.sectigo.com/SectigoRSAOrganizationValidationSecureServerCA.crt

Convert to pem file

@nanusdad
nanusdad / systemd-service-file.md
Last active May 30, 2024 05:50
Creating systemd service

Creating systemd service

Create Systemd Service File

sudo touch /etc/systemd/system/foo-daemon.service
sudo chmod 664 /etc/systemd/system/foo-daemon.service

Edit service file

vi /etc/systemd/system/foo-daemon.service
@nanusdad
nanusdad / mac-setup.md
Created May 13, 2024 17:39 — forked from orlando/mac-setup.md
Fresh Mac OS Setup

1. Run Software Update

Make sure everything is up to date in the App Store

2. Install Homebrew

  1. Open a terminal window and execute the Homebrew install script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@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 / 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 / alfresco-on-docker-cheatsheet.md
Last active May 23, 2024 08:53
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