vim :

Enable C like syntax highlighting :
set syntax=c
set syntax=off

Fold/unfold lines:
The command zr reduces folding by opening one more level of folds throughout the whole buffer (the cursor position is not relevant). Use zR to open all folds. The command zm gives more folding by closing one more level of folds throughout the whole buffer. Use zM to close all folds.

Hex edit :
:%!xxd       switch to hex edit mode
:%!xxd -r    switch back to normal mode

Show ctags list / Jump to a tag:
'g' + ']' OR Ctrl + ']'

ls :

List details :
ls -l

List by type :
ls -X

List by last modified :
ls -t

Reverse output of ls :
ls -r

diff and patch :

diff -ur foo modified/foo > foo.patch
patch -p1 < foo.patch

git :

1. create a new project "project" in your github account without README in it.

2. commit base project code to your github project
git clone https://github.com/others_uname/project
cd  project
git remote set-url origin https://github.com/your_uname/project.git
git config user.name "your name"
git config user.email "yourname@email.com"
git push -u origin master

3. update the file and verify the diff
git config --global core.editor vim
git config --global diff.tool vimdiff
git difftool

4. commit/push updated file to your github project
git status
git add .
git status
git commit -m "adding comment"
git push -u origin master

ffmpeg :

cut the video :
ffmpeg -i input_video.mp4 -ss 00:00:00 -to 00:01:02 -c copy output_video_cut.mp4

change framerate :
ffmpeg -i input_video.mp4 -r 15 output_video_reduced.mp4

Chrome :

Delete a single autosuggested/autocomplete URL :
- start typing the address as you normally would.
- when unwanted autocomplete suggestion appears, use keyboard arrow keys to highlight the suggestion in the drop-down below address bar
- press Shift-Delete


excluding files in a grep search:
grep -r "search_pattern" --exclude="*.out" --exclude="tags" *

ctags/cscope for python:

build cross-reference:
find . -name "*.py" > cscope-files
ctags -V -L cscope.files
cscope -v -b -i cscope.files
start cscope (without building a new cross-reference everytime):
cscope -d

No comments: