Skip to content

Instantly share code, notes, and snippets.

@royz
royz / MongoDB.md
Last active July 16, 2024 22:15
MongoDB - install, enable authentication & remote access on Ubuntu 20.04

Install MongoDB 5.x

Source: MongoDB Docs

1. Import the public key used by the package management system

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

2. Create a list file for MongoDB

@royz
royz / logger.js
Last active February 11, 2022 15:58
A logger config using winston
const path = require('path')
const winston = require('winston')
const LOG_DIR = path.join(path.dirname(path.dirname(__filename)), 'logs')
const consoleLogFormat = winston.format.combine(
winston.format.timestamp({format: 'DD/MM/YYYY HH:mm:ss'}),
winston.format.colorize(),
winston.format.printf(({level, message, label, timestamp}) => {
return `${timestamp} ${label ? `[${label}] ` : ''}${level}: ${message}`;
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 1,

Installation

Using chocolaty choco install oh-my-posh

USing powershell Install-Module oh-my-posh -Scope CurrentUser

Using winget winget install JanDeDobbeleer.OhMyPosh -s winget


Run this command from powershell (not from wsl)

docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=SECRET_PASSWORD_123 -v F:\DockerVolumes\postgres\data:/var/lib/postgresql/data:rw -d postgres
@royz
royz / mongodb_backup.py
Created November 2, 2022 13:59 — forked from Lh4cKg/mongodb_backup.py
MongoDB Dump And Restore Database With Python PyMongo Driver
import bson
from pymongo import MongoClient
def dump(collections, conn, db_name, path):
"""
MongoDB Dump
@royz
royz / TrueNAS boot drive partition.md
Created April 27, 2025 23:24
TrueNAS Scale - install in 16GB partition

This guide is useful for when installing truenas scale on large ssd. The idea is to create a small partition (16GB) to install the OS. And use the remaining space to create another partition for creating an nvme pool.

Tested on TrueNAS Scale v25.04.0

Mainly inspired from @sthames42 at https://gist.github.com/gangefors/2029e26501601a99c501599f5b100aa6

Steps for creating boot partition and installation

  1. Download TrueNAS Scale and burn to USB.
  2. Boot from USB and select Start TrueNAS SCALE Installation from the Grub loader menu.