Skip to content

Instantly share code, notes, and snippets.

@ixtiyoruz
Created August 17, 2021 00:24
Show Gist options
  • Save ixtiyoruz/4f8dd9c8a4081c604901b119589537b8 to your computer and use it in GitHub Desktop.
Save ixtiyoruz/4f8dd9c8a4081c604901b119589537b8 to your computer and use it in GitHub Desktop.
useful commands linux
to replace the word with another word in given files.
'replace "bottle" "box" -- ./images/*.xml'
@ixtiyoruz
Copy link
Author

ixtiyoruz commented Oct 12, 2021

to merge two branches

git checkout updating_branch_name
git merge branch_name_to_copy_from

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Oct 18, 2021

write text to a file :

echo "Hello you!" >> myfile.txt
echo "this is 2nd line text" >> file.txt
echo "last line!" >> file.txt

@ixtiyoruz
Copy link
Author

serve files inside directory

python3 -m http.server 8007

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Jan 26, 2022

to give the docker command permission to display things

xhost +local:root

@ixtiyoruz
Copy link
Author

in order to use nvidia while building docker use this https://stackoverflow.com/questions/67570694/how-to-build-yolact-using-docker

@ixtiyoruz
Copy link
Author

ixtiyoruz commented May 18, 2022

To do smth for every nth file in a folder

find 192.168.0.111 -type f | awk 'NR %1000 == 0'| xargs du -sh

@ixtiyoruz
Copy link
Author

ixtiyoruz commented May 28, 2022

Docker display example

--net allows the docker image to use host ip.
x11 things allows to use the dispaly
-e DISPLAY=:1 gives the display number.

code_folder="path"
docker run --rm -e DISPLAY=:1 --net=host -v /tmp/.X11-unix:/tmp/.X11-unix -v ${code_folder}:/home/code -it docker_image_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment