Skip to content

Instantly share code, notes, and snippets.

View Utshaw's full-sized avatar
🎯
Focusing

Farhan Tanvir Utshaw

🎯
Focusing
View GitHub Profile
@Utshaw
Utshaw / vector_copying_pointer
Created February 16, 2025 20:15
Pointer helps solve issues
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int>*> starship;
vector<int> midship;
midship.push_back(50);midship.push_back(80);midship.push_back(40);midship.push_back(45);
#include <iostream>
namespace Math {
int add(int a, int b) {
return a + b;
}
}
int main() {
std::cout << Math::add(5, 3) << std::endl; // Outputs: 8
@Utshaw
Utshaw / gist:df5db2c05b34c75c260b089e3da55abd
Created February 10, 2025 16:58
Platform specific preprocessing
#include <iostream>
int main() {
#ifdef _WIN32
std::cout << "Running on Windows" << std::endl;
#elif __APPLE__
std::cout << "Running on macOS" << std::endl;
#elif __linux__
std::cout << "Running on Linux" << std::endl;
#else
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Utshaw
Utshaw / pip_fixer.sh
Created December 10, 2020 13:22
pip python version mismatch
# Scenario:
# pip refers to python3
# python refers to python2
# pip install doesn't work for python instead works for python3
# Problem: Can't install modules for python2
#______________________________________________________________
# Solution:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
# Now pip install this way below (dnspython is the interesting module):
@Utshaw
Utshaw / finder.sh
Created June 6, 2020 04:00
find file not in /media directory
sudo find / -iname "*tomcat*" ! -path "/media/*"
@Utshaw
Utshaw / arrow.sh
Last active June 5, 2020 03:20
create arrow in gimp
find ~/ -iname "gimp" # find where gimp script directory is located
cd /home/utshaw/snap/gimp/273/.config/GIMP/2.10/scripts/
wget https://web.archive.org/web/20180208191139/http://registry.gimp.org:80/node/28566
@Utshaw
Utshaw / ssh.sh
Created June 5, 2020 02:59
ssh into remote machine in linux
# Let, user wants to ssh into remote machine from user machine
# User machine:
ssh-keygen
cat ~/.ssh/id_rsa.pub # then copy the content
# Remote machine
mkdir -p ~/.ssh && chmod 700 ~/.ssh ; touch ~/.ssh/authorized_keys
MY_KEY="<paste_here>"
echo "${MY_KEY}" >> ~/.ssh/authorized_keys
@Utshaw
Utshaw / avro_installer.sh
Created June 4, 2020 03:39
Avro installation in Ubuntu
sudo apt install ibus-avro
# Go to Region & Languages from Settings
# Click on "Manage Installed Languages" & click on install in the popup window
# Restart the machine
# Click on '+' sign , select Bangla (Bangladesh)
# Select Bangla (Avro Phonetic)
@Utshaw
Utshaw / mpv.sh
Last active April 24, 2020 05:26
mpv save last video/audio position
echo "save-position-on-quit" >> ~/.config/mpv/mpv.conf
# Acknowledgement: https://unix.stackexchange.com/questions/414639/is-it-possible-to-continue-movies-from-where-one-leaves-in-mpv-as-can-be-done-in