Skip to content

Instantly share code, notes, and snippets.

View hoangdh's full-sized avatar
🏠
Working from home

Dao Huy Hoang hoangdh

🏠
Working from home
View GitHub Profile
@hoangdh
hoangdh / install-openssh-9.3p2.md
Created May 17, 2024 07:02
Compile OpenSSH 9.3p2 from Source code
@hoangdh
hoangdh / jupyter-notes.md
Last active April 20, 2024 01:52
Một vài bước cài đặt Jupyterhub

Cài đặt Jupyter qua conda

conda install -c conda-forge jupyterhub  # installs jupyterhub and proxy
conda install jupyterlab notebook  # needed if running the notebook servers in the same environment

File cấu hình

Filename: jupyterhub_config.py

@hoangdh
hoangdh / migrate-mongodb.md
Last active February 19, 2024 14:04
Migrate data MongoDB to another cluster without dumping to local disk

Migrate data MongoDB to another cluster

  • Source cluster: 10.10.10.10
  • Destination cluster: 10.10.20.10
mongodump --host 10.10.10.10 --port 27017 --archive --numParallelCollections=10 | \
mongorestore --host 10.10.20.10 --port 27017 --archive --numParallelCollections=10 --drop
@hoangdh
hoangdh / instaloader.md
Last active February 4, 2024 10:31
Download all videos from Instagram

Install instaloader

pip3 install --user instaloader

Download all video from masukiye_bungalov channel

instaloader --post-filter="is_video" --no-video-thumbnails --no-metadata-json --filename-pattern={date_utc:%Y}/{shortcode} masukiye_bungalov
@hoangdh
hoangdh / install-mongodb-6.0.sh
Created January 25, 2024 09:59
Script to install mongodb on Ubuntu 22.04
echo "vm.zone_reclaim_mode=0
vm.swappiness=1
vm.max_map_count=102400" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf
apt-get install gnupg curl -y
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb -P /tmp
dpkg -i /tmp/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb && rm /tmp/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
@hoangdh
hoangdh / add-swap.sh
Last active October 2, 2023 13:53
Add swapfile on Linux
#!/bin/bash
fallocate -l 1G /swapfile;
chmod 600 /swapfile; mkswap /swapfile;
cp /etc/fstab /etc/fstab.bk;
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab;
swapon -a;
sysctl vm.swappiness=15;
sysctl vm.vfs_cache_pressure=50

When run apt update,

root@hadoop123:~# apt-get update
Get:5 https://repo.saltproject.io/py3/ubuntu/20.04/amd64/archive/3005 focal InRelease [2125 B]
Err:5 https://repo.saltproject.io/py3/ubuntu/20.04/amd64/archive/3005 focal InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E08A149DE57BFBE
Reading package lists... Done
W: GPG error: https://repo.saltproject.io/py3/ubuntu/20.04/amd64/archive/3005 focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E08A149DE57BFBE
E: The repository 'https://repo.saltproject.io/py3/ubuntu/20.04/amd64/archive/3005 focal InRelease' is not signed.
@hoangdh
hoangdh / touchpad
Created August 10, 2022 14:30
Switch Enable/Disable touchpad on Ubuntu
#!/bin/bash
if [ "$1" == "on" ]
then
synclient TouchpadOff=0
echo "$(date '+%F %T') - INFO: Touchpad is enabled."
elif [ "$1" == "off" ]
then
echo "$(date '+%F %T') - INFO: Touchpad is disabled."
synclient TouchpadOff=1
@hoangdh
hoangdh / cloudera_6.3.2_log4j-rce.md
Last active June 26, 2022 02:37
Fixed Log4j RCE Dec 10 2021 for Hadoop Cluster using CDH
@hoangdh
hoangdh / README.MD
Created August 19, 2021 17:42
Webhook example using Python Flask

Webhook Example

#!/usr/bin/python3
# -*- coding: utf-8 -*-

from flask import Flask, request

app = Flask(__name__)