Change default settings of VIM

On UNIX, Linux & MacOS only
Type the following to change the current directory to Home directory:

cd $HOME

Edit the file “.vimrc” by typing:

vi .vimrc

Add the following lines at the end of the existing text.

syntax on
set number

If the file “.vimrc” does not exist, go to /usr/share/vim/
Copy the text of the file “vimrc” and paste it in a new file in $USER/.vimrc and add the above mentioned lines.

The final script would look similar to this:

" Configuration file for vim
set modelines=0         " CVE-2007-2438

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible        " Use Vim defaults instead of 100% vi compatibility
set backspace=2         " more powerful backspacing

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup

let skip_defaults_vim=1

" Following lines are written by me
" The following line will switch ON Syntax Highlighting and Line Numbers.
syntax on
set number

Here is a screenshot:
VIM_DefaultSettings

Other Default Settings:
set tabstop=2
Will set 2 spaces to a tab.
set autoindent
Automatically indents all the new lines.

Credit: Ilmo Euro

Advertisements

Yet on the foggy windows,…

A

Yet on the foggy windows, its still your name I write

Hosting a Local Web server using PHP

php -S 192.168.0.57:80 -t ~/wherever/your/index/file/is/located

Here, 192.168.0.57 is the static IP Address assigned to the machine/laptop.

Deleting known SSH Hosts on UNIX

Using terminal, go to /Users/Username/.ssh

cd /Users/John/.ssh

Open the known_hosts file with a text editor of your choice

vi know_hosts

Each line here is a host that has been permenantly registered on your machine.
Delete the line that belongs to the unnecessary host.
Tip: In VIM, dd is the shortcut to delete the entire line.

Cheers
-l

PS. Life tip: To exit VIM, make sure you are in command mode by clicking ESC [escape] button on your keyboard/touch bar and type the following:

:wq

Browser

Change the User-Agent by inspecting the element.
Go to Network > three vertical dots at extreme right corner of network window > More Tools > Network Condition.
Change the User-Agent as requested and simply refresh the page.

Bravo!

PS. curl -A “User-Agent Here” http:// url .com

KillSwitch for VBS Scripts

Create a batch with the following line:

taskkill /F /IM wscript.exe /T

HOW TO CREATE A BATCH FILE?
wait, how did you learn vbs scripting without learning batch scripting in the first place? Nevermind 😉

  • Open Notepad.
  • Type the above command
  • Save it as “yummm.bat” [replace yummm with any name, but make sure to have .bat in the end]
  • CHANGING MAC ADDRESS

    ON Windows, Linux & MacOS

    MacOS
    1. Find the existing MAC Address for your WiFi adapter
    2. Generate a random MAC Address
    3. Assign the new MAC Address

    ifconfig en0 | grep ether
    openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
    sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx
    

    Windows
    We use PowerShell for this.
    1. Find the existing MAC Addresses
    I haven’t yet figured an easy way to generate a random MAC Address in PowerShell, so you need to have a MAC Address prior to this.
    2. Assign the new MAC Address

    Get-NetAdapter
    Set-NetAdapter -Name “WiFi” -MacAddress “de:be:ef:c0:fe”
    

    NOTE:
    The term “WiFi” is the name of my WiFi Adapter.
    Your computer might have a different name, which you can find when you type Get-NetAdapter command.

    Linux
    coming soon…