Skip to content

Instantly share code, notes, and snippets.

View DoZator's full-sized avatar
😺
Working

Oleg Bogatenko DoZator

😺
Working
View GitHub Profile
@DoZator
DoZator / mongodb-cheat-sheet.md
Created August 29, 2023 13:28 — forked from devkiran/mongodb-cheat-sheet.md
MongoDB Cheat Sheet

1. Insert a single document

db.products.insertOne({ name: 'Product 1', price: 200 })

2. Insert multiple documents - Ordered

db.products.insertMany([{ name: 'Product 1', price: 200 }, { name: 'Product 2', price: 100 }])
@DoZator
DoZator / DocumentDBConfig.java
Last active October 2, 2023 07:54
DocumentDB configuration example
@Slf4j
@Configuration
@RequiredArgsConstructor
public class DocumentDBConfig extends AbstractMongoClientConfiguration {
private static final String CERT_FILE_PATH = "document-db-certs/rds-combined-ca-bundle.pem";
private static final String END_OF_CERTIFICATE_DELIMITER = "-----END CERTIFICATE-----";
private static final String CERTIFICATE_TYPE = "X.509";
private static final String TLS_PROTOCOL = "TLS";
@DoZator
DoZator / README.md
Last active October 24, 2024 11:22
Show octal file permissions (Linux)

Show octal file permissions in Linux

stat -c '%A %a %n' *
@DoZator
DoZator / README.md
Last active April 8, 2024 13:31
Postgres (useful commands)

PostgreSQL

Connecting to database

psql -h <host> -U <username> <database-name>

or

psql -h <host> -U <username> -l
@DoZator
DoZator / README.md
Created October 24, 2024 11:34
Get public key of a pem file

Copy the public key to clipboard

Linux

ssh-keygen -f private.pem -y | xclip

macOS

@DoZator
DoZator / README.md
Created March 5, 2025 20:10
Generate OpenSSL private and public keys

Generate RSA 1024 bit key:

openssl genrsa -out private_key.pem 1024

Get public key from private:

openssl rsa -in private_key.pem -pubout -out public_key.pem
@DoZator
DoZator / README.md
Last active April 8, 2025 07:54
Kubernetes cheatsheet

Cluster & Context

  • List all available contexts
kubectl config get-contexts
  • Show current context