Skip to content

Instantly share code, notes, and snippets.

@nanusdad
nanusdad / MSSQL-backup-restore-on-MacOS.md
Last active September 11, 2024 09:24
Restoring MSSQL backup file on MacOS and querying data

MSSQL commands on Azure Data Studio

To read a .bak file from a MS SQL Server database on MacOS, one has to run MS SQL server using Docker and then use Azure Data Studio to access / query the database after restoring it.

Installing Docker image

You need to have Docker installed. Docker Desktop for MacOS is available at this link.

Once installed run the following commands.

# Pull latest image
@nanusdad
nanusdad / accessing-apple-screen-time-data.md
Created September 3, 2024 08:36 — forked from 0xdevalias/accessing-apple-screen-time-data.md
Some notes on accessing / exporting Apple's Screen Time data
@nanusdad
nanusdad / Windows RDP login prompt
Created September 2, 2024 10:16 — forked from vishnumitraha/Windows RDP login prompt.md
Dell Thin Client to boot directly into a Windows RDP login prompt
To configure a Dell Thin Client to boot directly into a Windows RDP login prompt, you need to adjust the settings in the `wnos.ini` file and ensure the correct configuration for Remote Desktop connections. Here are the steps to achieve this:
### 1. **Edit the wnos.ini File**
The `wnos.ini` file is used to configure various settings for the Dell Thin Client. You need to modify this file to enable direct RDP login.
1. **Access the wnos.ini File**:
- You can edit the `wnos.ini` file using the Wyse Management Suite or by manually editing it if you have access to the file system of the thin client.
2. **Add Necessary Settings**:
@nanusdad
nanusdad / gist:dba4e71a56838b102a94ebc53eb845d1
Created July 24, 2024 06:07 — forked from vishnumitraha/gist:7c4fa85bf09e8c5a9384c875468420cb
Let's Encrypt SSL certificate to an Amazon S3 static site

To add a Let's Encrypt SSL certificate to an Amazon S3 static site, you will need to use Amazon CloudFront as an intermediary, since S3 does not support SSL certificates directly. Here are the detailed steps to achieve this:

Step 1: Set Up Your S3 Bucket

  1. Create an S3 Bucket:

    • Go to the AWS Management Console.
    • Create a new S3 bucket with a unique name (this will be your static website).
    • Enable static website hosting in the bucket properties.
  2. Upload Your Website Files:

@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 [email protected])

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)