07, Jul 2024
2024-07-01
Vim Learnings
Scripts:
- Echoing Messages ::
:ec
or:echo
prints out the message, example:ec "hello world"
- Persistent Echoing::
:echom "<message>"
or:echomsg "<message>"
, stores these messages in the message history - Help ::
:help <commandname>
Keybinding:
- Keybinding
x
: deletes the character next to the cursor - Deletion:
dd
: deletes the entire line - Deletes a word:
dw
, from the cursor until the space is found - Deletes characters till EOL:
d$
deletes characters from the right of the cursor to the End of the Line
Deletion on Operators and motions: takes the form of d motion
list of motions:
w
: until the start of next word, excluding the first character
e
: to the end of the current word, including the last character
$
: to the end of the line
In case of deletion with motions:
dw
: deletes the word until the start of next word
de
: deletes until end of the current word
d$
: deletes until end of line
Count with motion:
2w
: moves the cursor two words forward
4e
: moves the cursor 4 words to the end of fourth word forward.
Deletion with count and motion:
d2w
: deletes two words until the start of the next word
d2e
: deletes two words until the last character of the second character
Lines:
dd
: deletes the entire line
d2d
: count with deletion of two lines
Undo & Redo
u
: Undoing the latest change
CTRL+R
: Redoing the latest change
Vim Learning Resources [1] https://learnvimscriptthehardway.stevelosh.com/ [2] https://vim-adventures.com/ [3] vimtutor
2024-07-02
- rsync: stands for remote sync, which is used for remote and local file synchronization, alternative to
ssh
,scp
- Local to Local
- Local to Remote
- Remote to Local
-a
: option to sync files recursively
-P
: option to show the progress of the transfer
- zimfw change theme
Install
zsh
before installing zimfwcurl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
2024-07-03
Vim Learnings
Keybindings
Put command:
p
: put/paste the deleted text, after the text cursor
Replace Command:
r<character>
: replace command, for example the wordtypod
whereo
has to be replaced withe
to make ittyped
, move the cursor to the start of the character to be placed(until o) and typere
to replaceo
withe
.
Change Command: delete all the characters from the cursor till the end of the word.
ce
:VNKLO
, move the cursor to the right ofV
and inputce
,which deletes all the characters till the end, and type in the required characters.
Internet Protocol
IPV4
32bit integers,represented in 4 numbers separated by .
and the numbers are ranging from 0-255.
192.168.1.1
: example of IPV4 address.
Drawbacks:
- Limited Address space
- Complex configuration: IPv4 requires mannual configuration or DHCP to assign address.
- Fragmentation: IPv4 allows to fragment packets,chances of packets getting lost.
IPV6
To support increased use of computer networks, internet enabled devices, ipv6 was invented.
- Enhanced packet header for efficient routing.
- Data security through IPSec header field.
Ipv6 address representation as x:x:x:x:x:x:x:x
,where x is the hexadecimal values of eight 16digit pieces.
Ipv6 addresses ranges from:
0000:0000:0000:0000:0000:0000:0000:0000
to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Shorthand formats of IPV6 addresses.
-
Omit leading zeros Specify IPv6 addresses by omitting leading zeros. For example, IPv6 address 1050:0000:0000:0000:0005:0600:300c:326b can be written as 1050:0:0:0:5:600:300c:326b.
-
Double colon Specify IPv6 addresses by using double colons (::) in place of a series of zeros. For example, IPv6 address ff06:0:0:0:0:0:0:c3 can be written as ff06::c3. Double colons can be used only once in an IP address.
2024-07-04
Vim Keybinding
-dG
: deletes from the cursor till the last line of file
2024-07-07
git
git stash
: recording the state of working directory with changes to the working directory,but want to go back to the clean working directory, this saves local changes and reverts the working directory to the HEAD.
For example your present working directory is branch1 and made a few local changes and these local changes has to be in another new branch, branch2
git stash
: stash the local changesgit stash branch branchName
: creates a new branch with the branch name as<branchName>
and the local changes which were stashed are moved to the new branch.git stash pop
: to pop out the stashed changes in the new branch created.
git notes
: is a feature to add extra information to a commit without the need to changing the commit itself.
$ git notes add -m "testing notes feature for the latest commit"
$ git log
commit e2d42c8b5104bb71b2697e723e23eb161684fbe4 (HEAD -> master, origin/master, origin/HEAD)
Author: Vinay Keshava <vinaykeshava@email.com>
Date: Wed Jul 3 17:54:57 2024 +0530
wily:July 3rd
Notes:
testing notes feature for the latest commit
git notes add -m "<message>"
: adding notes to the lastest commitgit notes add -m "<message>" <commit-id>"
: adding a note to a particular commitgit notes append -m "<message>" <commit-id>
: appending a note to existing commitgit notes remove <commit-id>
: removing notes for a particular id.
Vim Learnings
CTRL-G
: displays the file postion and other details.gg
: moves the cursor to the top of the file.G
: moves the cursor to bottom of the file.
Substitute command
s/<oldphrase>/<newphrase>
: replaces the single occurence of old phrase with the new phrase.s/<oldphrase>/<newphrase>/g
: to find and replace every occurennce.s/<oldphrase>/<newphrase>/gc
: to find and replace every occurennce of the phrase with a prompt to be replaced or not.
/bin/bash
BASH stands for ‘Bourne Again SHell’, shell programming uses other common shells like sh,csh etc. Shell programming can be achieved by directly executing commands at the shell prompt.
Shebang: #!/bin/bash
telling the operating system which interpreter to be used to parse the rest of the file.
Ansible
Ansible is a open source tool, that automates application deployment, cloud provisioning, intra-service orchestration.
2024-07-08
Vim Learnings
- Executing commands using
:!<command-name>
- used to execute the command for example!ls
will list the files in the current working directory and press ENTER to continue.
Writing to New files
-
Writing more files, copying the same contents of the existing file to another file using
:w <new-file-name>
, say for example working on the filehellohello.txt
and you execute the command:w hello1.txt
will copy the same contents onto another new file calledhello1.txt
. -
Copying the selected content onto a new file: Enter visual mode by pressing
v
, and in the below prompt:'<,'>
and then follow the above similar step to save the copied contents onto new file.:'<,'> w hello1.txt
, the new filehello1.txt
is created with the selected content.
2024-07-25
zsh and fzf configuration
-
for autosuggestion and syntax highlighting install the packages
zsh-autosuggestion and zsh-syntax-highlighting
-
wrote a blog post here for configuring fzf with zsh-fzf
2024-07-26
caddy webserver configuration
Serving a static files like hugo from caddy webserver, with the below example
https://domain1.in, https://www.domain1.in {
root * /var/www/html/domain1
file_server
}
where /var/www/html/domain1
is the location of the static files.
To serve a reverse_proxy for an application running in localhost on port 8085
.
https://domain-name.tld {
reverse_proxy localhost:8085
}
2024-07-27
- Self hosted thelounge irc server using docker and set up the proxy in Caddyfile
2024-07-29
- Writing a .bat file in windows, starting a particular .exe file
start %SOME_PATH_OF_THE_EXE%\file.exe
- Setting a path to a variable in
.bat
file
SET JAVA_HOME="C:\ProgramFiles..
SET JDK=%JAVA_HOME%\bin
2024-07-30
- i3 config - to remove the top border in i3wm
default border pixel 0
- connecting irc oftc network in thelounge, click on add network and then irc.oftc.net with port 6697
2024-07-31
-
lazy vim configuration clone the lazy vim git repository and move it to the configuration folder of
neovim
and that’s it start using it. -
copying text to clipboard in neovim, use visual mode and copy the selected text and type
"+y
and press enter.
2024-07-31
-
lazy vim configuration clone the lazy vim git repository and move it to the configuration folder of
neovim
and that’s it start using it. -
copying text to clipboard in neovim, use visual mode and copy the selected text and type
"+y
and press enter.