Sublime Cheatsheet

Go to file Ctrl + P Toggle Sidebar Ctrl + K B Select line Ctrl + L Select word Ctrl + D Select content into brackets Ctrl + Shift + M Insert line before Ctrl + Shift + Enter Insert line after Ctrl + Enter Delete line Ctrl + Shift + K Duplicate lines Ctrl + Shift + D Join lines Ctrl + Shift + J Jump to matching bracket Ctrl + M ...

September 21, 2021 · 1 min · 73 words · Saqib Razzaq

Git Cheatsheet

Git Cheatsheet Get remote URL git remote -v Set remote URL git remote set-url origin git@bitbucket.org:user/repo.git Update remote branches list git remote update origin --prune Delete local branch git branch -d branchname Delete branch locally and remote git push origin --delete fix/authentication Create branch from another git checkout -b newbranch sourcebranch Soft reset (remove last commit) git reset --soft HEAD~1 Remove all local branches already merged into master (including dev) git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d

September 15, 2021 · 1 min · 84 words · Saqib Razzaq

MySQL Cheatsheet

copy a table with schema, indexes and data First, copy the table with indexes CREATE TABLE new_name LIKE table_to_copy; Then copy the data by running INSERT INTO new_name SELECT * FROM table_to_copy; create BTREE Indexes CREATE INDEX index_name ON table_name (column1, column2, ...); create FULLTEXT indexes ALTER TABLE `TableName` ADD FULLTEXT INDEX `IndexName` (`ColumnName`); create new user and give all privilages CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost'; create or drop multiple indexes in same query Create multiple indexes ...

September 1, 2021 · 2 min · 261 words · Saqib Razzaq

Docker Cheatsheet

Show images docker images Show containers docker ps Show running containers docker ps -a Connect to a running container docker exec -it container_id bash Start container docker start container_id Stop container docker stop container_id Remove Container docker rm container_id Pull container docker pull image_name Commit a container docker commit -m "message" -a "Author" container_id username/repo_name Remove all containers docker rm $(docker ps -a -q) Stop all containers docker kill $(docker ps -q) ...

July 11, 2021 · 1 min · 102 words · Saqib Razzaq

Terminal Cheatsheet

A list of common terminal shortcuts + most common cli programs in Linux terminal ctrl + a move to start of a line ctrl + e move to end of a line Alt-f Move the cursor forward by one word Alt-b Move the cursor backward by one word ctrl + u Delete an entire line ctrl + k Delete everything after cursor Ctrl + Shift + F Find any text clear or ctrl + l to clear terminal reset clear everything and remove scroll cal show calendar command; command2 for running multiple commands regardless of output command && command2 for running commands only when first is successful ...

December 11, 2020 · 2 min · 242 words · Saqib Razzaq

FFMPEG Cheatsheet

add subtitles You can hardcode subtitles by providing a subtitles files and running the following command ffmpeg -i input.mp4 -vf subtitles=subs.srt out.mp4 add watermark in any position The base command for adding watermark looks like this ffmpeg -i input.mp4 -i watermark.png -filter_complex "POSITION_HERE" out.mp4 You can replace POSITION_HERE with any position you need from the following Top Right overlay=main_w-overlay_w-10:10 Top Left overlay=10:10 Bottom Right overlay=main_w-overlay_w-10:main_h-overlay_h-10 Bottom Left overlay=10:main_h-overlay_h-10 Center overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2 extract audio If you need to extract audio of a video with re-encoding the whole thing then you can run following command ...

August 11, 2019 · 2 min · 406 words · Saqib Razzaq