/images/avatar.png

xsel for buffer

Install package to save file context into clipboard buffers: 1 sudo apt install xsel To save in the primary (to paste: Shift + Insert, xsel -po): 1 cat /etc/hosts | xsel -ip To save in the secondary (to paste: xsel -so) 1 cat /etc/hosts | xsel -is xsel -x - Exchange the PRIMARY and SECONDARY selections To save in the clipboard (to paste: Ctrl + V, xsel -bo) 1 cat /etc/hosts | xsel -ib From man:

Put file in a folder on NextCloud

Go to NextCloud, open Settings -> Security -> fill “App name” -> click “Create new app password”, so we got login and pass. Create folder in your NextCloud. Fill varables with your own values: 1 2 3 4 5 6 USER=96EEDA25-C3DA-XXXX-XXXX-XXXXXXXXXXXX PASS=3XabR-rygAb-XXXXX-XXXXX-XXXXX NEXTCLOUD_FOLDER=gitlab-backups PATH_TO_BACKUP=gitlab-backups BACKUP_NAME=1691665722_2023_08_10_14.9.2_gitlab_backup.tar NEXT_CLOUD_URL=https://your.cloud.tld Run the script: 1 curl -k -u "$USER:$PASS" -T "$PATH_TO_BACKUP/$BACKUP_NAME" "$NEXT_CLOUD_URL/remote.php/webdav/$NEXTCLOUD_FOLDER/$BACKUP_NAME"

Install, backup and restore Neo4j database

Quick links | Ubuntu 22.04 | Installation | Some activities with neo4j database | Backup neo4j database | Restore neo4j database Before install you have to check your OpenJDK version, for example for neo4j 5.8.0 you should have openjdk 17.0.7 2023-04-18. Installation: Some article who helps install it. Get gpg.key and add neo4j repository: 1 2 3 curl -fsSL https://debian.neo4j.com/neotechnology.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/neo4j.gpg echo "deb [signed-by=/usr/share/keyrings/neo4j.gpg] https://debian.neo4j.com stable latest" | sudo tee -a /etc/apt/sources.

Back up and restore with MongoDB tools

Quick links | Ubuntu 22.04 | Connect to MongoDB | Work with mongo | Import and restore MongoDB backup methods from official documentation: Back Up with Atlas MongoDB Atlas, the hosted MongoDB service option in the cloud. Back Up with MongoDB Cloud Manager or Ops Manager: https://www.mongodb.com/docs/manual/core/backups/#mms https://www.mongodb.com/docs/manual/core/backups/#ops-manager With Ops Manager, MongoDB subscribers can install and run the same core software that powers MongoDB Cloud Manager on their own infrastructure. Back Up by Copying Underlying Data Files Back Up with Filesystem Snapshots Back Up with cp or rsync Back Up with mongodump Let’s consider back up with mongodump!

Import and export MongoDB collections

Quick links | Ubuntu 22.04 | Mongo import | Mongo export Prepare a mongo server instance: 1 2 3 docker run --rm --name mongo -d mongo:6 docker exec -it -w /root mongo bash apt update && apt -y install curl less jq We are in the container, so all command will run from root! Import MongoDB is one of the most popular NoSQL database engines. For our test we can take the most popularsample MongoDB database about restaurants:

How to use ssh and scp in Windows

| Windows Server 2019 Run Powershell as an administator and generate private and public keys 1 ssh-keygen -trsa -b2048 Check that files exists 1 ls $env:USERPROFILE\.ssh Add public key 1 type $env:USERPROFILE\.ssh\id_rsa.pub | ssh root@192.168.131.10 "cat >> .ssh/authorized_keys" Check connect without password 1 ssh root@192.168.131.10 Check that commands are runned 1 ssh root@192.168.131.10 "cat /etc/*release" Put the file into /tmp 1 scp "$env:USERPROFILE\.ssh\id_rsa.pub" "root@192.168.131.10:/tmp/" Put several files into /tmp 1 2 3 scp -r "C:\tmp" "root@192.