Skip to content

Instantly share code, notes, and snippets.

@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.
@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

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

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


{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 1,
@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}`;
@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 / ubuntu-sys-info.md
Created November 12, 2021 03:17
show sys info on ubuntu (like the one after startup)
. /etc/update-motd.d/50-landscape-sysinfo
setInterval(() => {
document.querySelectorAll(".circular.style-scope.yt-icon-button")[12].click();
document.querySelectorAll(".style-scope.ytd-menu-popup-renderer")[3].click();
}, 500);
@royz
royz / .bashrc
Last active April 8, 2022 19:09
#!/bin/bash
# enable color support of ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'