Skip to content

Instantly share code, notes, and snippets.

View ZulianTiger's full-sized avatar
⚛️

Armin ZulianTiger

⚛️
  • Sarajevo, Bosnia & Herzegovina
View GitHub Profile
@ZulianTiger
ZulianTiger / digitalocean-subdomain-deployment
Last active December 27, 2022 23:11
How to create additional subdomains on digitalocean ubuntu droplet
1. Configure Nginx as a Reverse Proxy
a) cd /etc/nginx/sites-available (navigate to nginx sites folder)
b) sudo touch api.example.com (create a site enrty)
c) sudo nano api.example.com (open it in a text editor)
d) Add following code in it:
server {
listen 80;
listen [::]:80;
root /var/www/html;
@ZulianTiger
ZulianTiger / firebase-config-nextjs.js
Last active December 5, 2021 13:03
Firebase config for Next.js
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import "firebase/app-check";
const CONFIG = {
apiKey: process.env.NEXT_PUBLIC_FIREBASE_KEY,
authDomain: process.env.NEXT_PUBLIC_FIREBASE_DOMAIN,
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
databaseURL: process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL,
@ZulianTiger
ZulianTiger / firebase-firestore-services.js
Last active December 5, 2021 13:03
Firebase firestore services
/* eslint-disable */
import firebaseApp from "../config/firebase";
import firebase from "firebase";
//READ WHOLE COLLECTION
export async function getAllCollection(collection) {
try {
const db = firebase.firestore(firebaseApp);
const data = await db.collection(collection).get();
const dataResult = data.docs.map((doc) => doc.data());
@ZulianTiger
ZulianTiger / gist:df2671b6191f17315f14dfde2ec4a36e
Created September 3, 2021 11:57
Whitelisting IP addres for remote postgres database access
//Connect t
ssh user@ip-address
//Navigate to postgres config
cd ../../etc/postgresql/12/main
//Open config file and scroll to bottom
sudo nano pg_hba.conf
//Add line to the end (Don't forget '/32' subnet mask at the end of IP address)
@ZulianTiger
ZulianTiger / gist:45ff5e7eb63f801e95f2bd878c8d3e12
Created September 3, 2021 11:01
ubuntu-postgres-diagnostics
Certify that postgresql service is running, using sudo service postgresql start
Run pg_lsclusters from your terminal
Check what is the cluster you are running, the output should be something like:
Version - Cluster Port Status Owner Data directory
9.6 ------- main -- 5432 online postgres /var/lib/postgresql/9.6/main
@ZulianTiger
ZulianTiger / digitalocean-deployment.txt
Last active April 26, 2024 11:44
How to Deploy a Next.js Website to a DigitalOcean Server
***Simple and stripped down version of this post: https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server ***
1. Create a New Droplet On DigitalOcean
a) In the first section, select the Ubuntu operating system for your server
b) In the "Authentication" section, make sure the "Password" option is selected and enter a strong root password for your server.
2. Access Server Using Root
a) ssh root@server_ip_address (connect to server from terminal)
3. Add user (OPTIONAL)
@ZulianTiger
ZulianTiger / nodemailer-office365-smtp.js
Created May 19, 2021 20:28
Nodemailer SMTP config for office365
let transporter = nodemailer.createTransport({
host: 'smtp.office365.com',
port: 'XXX',
secureConnection: true,
tls: { ciphers: 'SSLv3' },
auth: {
user: 'xxxx@xxxxxxx.xxx',
pass: 'xxxxxxxx'
}
});