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 Aug 20, 2021

searching files with extension

find . -name "*.zip" -type f

to delete the files with extension

find . -name "*.zip" -type f -delete

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Aug 27, 2021

making a video from images.

ffmpeg -framerate 25 -pattern_type glob -i 'video0/*.jpg' -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Oct 10, 2021

latex cheatsheet

http://wch.github.io/latexsheet/

have fun !

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Oct 12, 2021

to reject some commit in github:

run this and take the commit hash
git log --oneline
for example lets 'cd7fe3a' be the last wrong commit and '2c28dde' be the last good commit. So you want to 2c28dde .
git reset --hard 2c28dde
git commit -a
git push origin master -f

@ixtiyoruz
Copy link
Author

ixtiyoruz commented Oct 12, 2021

to create a new branch

git checkout -b new_branch_name branch_name_to_copy
git push -u origin new

@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