Skip to content

Instantly share code, notes, and snippets.

View Subangkar's full-sized avatar
☺️
Beauty in the Chaos

Subangkar Karmaker Shanto Subangkar

☺️
Beauty in the Chaos
View GitHub Profile
@Subangkar
Subangkar / anaconda-pip.sh
Last active June 30, 2023 07:07
Anaconda, Python & Pip shell commands
# anaconda
conda create -n myenv
conda create -n myenv python=3.9
conda activate myenv
conda deactivate
conda env list
conda info --envs
@Subangkar
Subangkar / Binary-Search.asm
Last active May 20, 2022 03:25
8086-Assembly-Language Procedure for Binary Search
BIN_SEARCH PROC
;search in a sorted array by the binary search method
;input: SI = array offset address
; BX = number of elements
; CX = key
;output: SI = offset of sorted array
; AX = pos @where key has been found
;PUSH AX
PUSH BX
PUSH CX
@Subangkar
Subangkar / linux-commands.sh
Last active December 25, 2021 09:04
Common Linux Commands for remote server machine
# Internet speed Test Check with speedtest-cli
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
# Show free RAM
free -h
vmstat
# Show CPU config
lscpu
@Subangkar
Subangkar / Colab-Notebook.md
Last active December 24, 2021 05:01
Handy snippets/codes for Google Colaboratory Notebooks

Auto Reconnect using Browser console:

Use any one of snippets from the following blocks

function ClickRefresh(){
    console.log("Clicked on refresh button"); 
    document.querySelector("paper-icon-button").click()
}
setInterval(ClickRefresh, 60000)
@Subangkar
Subangkar / rename_files_to_foldername.py
Created September 10, 2021 05:59
Rename every file to the name of its parent folder
#!/usr/bin/env python3
# import shutil
import os
import sys
import re
from shutil import copyfile
dr = str(sys.argv[1])
ext = str(sys.argv[2])
dest = str(sys.argv[3])
@Subangkar
Subangkar / download_drive.py
Last active September 10, 2021 05:57
Downloading Publicly shared files from Google Drive in Python
#taken from this StackOverflow answer: https://stackoverflow.com/a/39225039
import requests
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
token = get_confirm_token(response)
@Subangkar
Subangkar / Shell Scripts.sh
Last active October 5, 2020 15:41
Useful GNU Bash Scripts
# Common Contents of two text files -------------
diff -y -w --strip-trailing-cr -i --minimal --color=always file1 file2 | grep -n -v'' "[|<>]"
diff --ignore-blank-lines --ignore-space-change --ignore-trailing-space --ignore-case --minimal --strip-trailing-cr --unchanged-group-format='@@ %dn, %df
%<' --old-group-format='' --new-group-format='' --changed-group-format='' file1 file2
# -------------------------------------------
# CSV like parsing
sed 's/,,/, ,/g;s/,,/, ,/g' data.csv | column -s, -t
@Subangkar
Subangkar / docker-compose.sh
Last active September 17, 2020 07:07
Useful Docker Commands
docker-compose build
docker-compose up
docker-compose down
@Subangkar
Subangkar / sshfs-mount.md
Last active September 7, 2020 06:32
Mounting over ssh on windows

Mount remote linux server folder

  • sshfs-win
  • WinFsp
    Open Map Network drive from Win Explorer and add network path as
\\sshfs\user@host/../../path_from_root/
@Subangkar
Subangkar / .gitattributes
Created May 16, 2020 13:09
Common git attributes like ignore auto crlf etc.
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
# Never modify line endings of our bash scripts
*.sh -crlf