Queues REDIS

How to resolve laravel Connection refused [tcp://] ?

#1 inst all Redis on your mac as follow

brew install redis

Launch Redis on computer starts.

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Start Redis server via “launchctl”.

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Start Redis server using configuration file.

$ redis-server /usr/local/etc/redis.conf

Stop Redis on autostart on computer start.

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Location of Redis configuration file.


Uninstall Redis and its files.

$ brew uninstall redis
$ rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Get Redis package information.

$ brew info redis

Test if Redis server is running.

$ redis-cli ping

How to fix GIT (modified content) ?

Here is the command on how to resolve (modified content)

git rm -rf --cached yourfolder

Programming Programming Language

What are VI / VIM editor helper commands ?


vi command description

0 move to beginning of the current line $ move to end of line H move to the top of the current window (high) M move to the middle of the current window (middle) L move to the bottom line of the current window (low) 1G move to the first line of the file 20G move to the 20th line of the file G move to the last line of the file


:wq or :x or ZZ - write (save) and quit


:n 	Go to line n
nG 	Go to line n


yy - yank (copy) a line
2yy - yank (copy) 2 lines
yw - yank (copy) the characters of the word from the cursor position to the start of the next word
y$ - yank (copy) to end of line


p - put (paste) the clipboard after cursor
P - put (paste) before cursor


dd - delete (cut) a line
2dd - delete (cut) 2 lines
dw - delete (cut) the characters of the word from the cursor position to the start of the next word
D - delete (cut) to the end of the line
d$ - delete (cut) to the end of the line
x - delete (cut) character

Cursor movement

h - move cursor left
j - move cursor down
k - move cursor up
l - move cursor right
H - move to top of screen
M - move to middle of screen
L - move to bottom of screen
w - jump forwards to the start of a word

Working with multiple files

:e file - edit a file in a new buffer
:bnext or :bn - go to the next buffer
:bprev or :bp - go to the previous buffer
:bd - delete a buffer (close a file)
:ls - list all open buffers
:sp file - open a file in a new buffer and split window
:vsp file - open a file in a new buffer and vertically split window
Ctrl + ws - split window
Ctrl + ww - switch windows
Ctrl + wq - quit a window
Ctrl + wv - split window vertically
Ctrl + wh - move cursor to the left window (vertical split)
Ctrl + wl - move cursor to the right window (vertical split)
Ctrl + wj - move cursor to the window below (horizontal split)
Ctrl + wk - move cursor to the window above (horizontal split)

Search and replace

/pattern - search for pattern
?pattern - search backward for pattern
\vpattern - 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
n - repeat search in same direction
N - repeat search in opposite direction
:%s/old/new/g - replace all old with new throughout file
:%s/old/new/gc - replace all old with new throughout file with confirmations
:noh - remove highlighting of search matches

Search in multiple files

:vimgrep /pattern/ {file} - search for pattern in multiple files

e.g.:vimgrep /foo/ */

:cn - jump to the next match
:cp - jump to the previous match
:copen - open a window containing the list of matches

How to SEO ?

  • Sitemap
  • Sitemap Submission
  • robots.txt
  • canonical names

How to Find php hacked files ?

grep -r --include=*.php -e '[[:alnum:]\/\+]\{137,\}'

How to kickout illegal ssh user from your unix server ?

Type who the -u flag; the PID is the number off to the right:

> who -u
ec2-user pts/1        2019-11-14 16:52 00:02   16035 (
Look up the process ID of the shell their TTY is connected to: 
> ps t   PID   TTY      STAT   TIME COMMAND   16035 pts/1    Ss     0:00 zsh 

Laugh at their impending disconnection (this step is optional, but encouraged) 
> echo "HAHAHAHAHAHAHAHA" | write ec2-user pts/1 

Kill the corresponding process: > kill -9 16035 

How to clear cache in Symfony ?

rm -rf var/cache/*

How to add new ssh key to github

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa (regular unix system)
$ ssh-add -K ~/.ssh/id_rsa (for macbook)

$ pbcopy < ~/.ssh/ (for macbook)

Paste key into github

$ git remote add origin [email protected]:xxxxxx/xxxxxxx.git  
$ git remote -v 
$ git push -u origin master

How to GIT ERROR: Repository not found. ?

$ git push origin master

ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
  and the repository exists.


Critical command line to address the issue –

Ensure ssh-agent is enabled:

Start the ssh-agent in the background

eval "$(ssh-agent -s)"
Golang SEO Web Server

How to web crawl a website ?

I am experimenting a web crawler COLLY – And it is fantastic !!

Have a look ! Golang


How to create alias with Bash ?

Common Commands

alias q='exit'
alias c=clear'
alias h='history'
alias cs='clear;ls'
alias p='cat'
alias pd='pwd'
alias lsa='ls -a'
alias lsl='ls -l'
alias pd='pw
’alias t='time'
alias k='kill'
alias null=’/dev/null'