Skip to content

Instantly share code, notes, and snippets.

@theonesud
theonesud / docker.sh
Created April 20, 2024 07:21
Install Docker
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
@theonesud
theonesud / mount_share.sh
Created April 3, 2024 05:56
share folder in vmware settings and then in linux type this to mount the folder
/usr/bin/vmhgfs-fuse .host:/ /home/sud/vmshare -o subtype=vmhgfs-fuse
@theonesud
theonesud / install_conda.sh
Created April 3, 2024 04:48
Install latest conda
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh
@theonesud
theonesud / Nginx SSL configuration.md
Last active January 14, 2023 07:38
Route Backend/Frontend through Nginx and add SSL to the domain

Route Backend/Frontend through Nginx and add SSL to the domain

Install nginx and firewall

  • sudo apt update
  • sudo apt install nginx
  • sudo ufw enable
  • sudo ufw allow https
  • sudo ufw allow 'Nginx HTTP'
  • sudo systemctl status nginx
  • sudo nano /etc/nginx/conf.d/tigc.techtact.conf
@theonesud
theonesud / terminal_setup.sh
Last active May 19, 2024 11:53
Install zsh, oh-my-zsh, powerlevel10k
sudo apt update
sudo apt upgrade
sudo apt install curl wget htop zsh git nvtop
# Set as default terminal
echo 'exec zsh' >> ~/.bashrc
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
@theonesud
theonesud / how-to-copy-aws-rds-to-local.md
Created December 2, 2020 05:38 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@theonesud
theonesud / noSleep Colab.js
Created July 16, 2020 19:00
Prevent colab from disconnecting by running this in browser console
function ClickConnect(){
console.log("Clicked on connect button");
document.querySelector("colab-connect-button").click()
}
setInterval(ClickConnect,60000)
@theonesud
theonesud / datetime
Created May 8, 2019 12:43
datetime funcs
# String to datetime
datetime_obj = datetime.strptime(f'{b.booking_date} {hr}', '%Y-%m-%d %H:%M')
# Current time in a TZ
datetime_obj = datetime.now(pytz.timezone('Asia/Kolkata')).replace(tzinfo=None)
@theonesud
theonesud / reset_seq.sql
Created January 5, 2019 16:22
reset a postgres sequence after manual entry
select setval('tablename_id_seq', (select max(id) from tablename));
sudo lsof -i -n -P | grep TCP