Categories
Continuous Integration/Development Git

How to resolve GITHUB key already in use ?

Find out which repository is already in use

ssh -T -ai ~/.ssh/id_rsa [email protected]

Solution 1

#1 Remove the key from your GITHUB repository->deploy

#2 Copy your key from macbook

pbcopy < ~/.ssh/id_rsa.pub

#3 Paste your key in the Github->repository you want to use

Solution 2

you can do a do a git clone against the https url

git clone https://git.com/david/global-helpers.git

Categories
Laravel

How to fix laravel failed loading cafile stream: `/usr/local/etc/openssl/cert.pem’ ?

Ho to fix laravel failed loading cafile stream: `/usr/local/etc/openssl/cert.pem’ ?

In your mac execute the following command

brew reinstall wget
Categories
Queues REDIS

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

#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.

/usr/local/etc/redis.conf

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
Categories
Git

How to fix GIT (modified content) ?

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

git rm -rf --cached yourfolder

Categories
Programming Programming Language

What are VI / VIM editor helper commands ?

VIM-helper

https://devhints.io/vim

https://vim.rtorr.com/

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

SAVE QUIT

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

GO TO LINE

:n 	Go to line n
nG 	Go to line n

COPY

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

Paste

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

DELETE

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
Categories
SEO

How to SEO ?

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

How to Find php hacked files ?

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

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 (104.245.199.125)
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 
Categories
PHP

How to clear cache in Symfony ?

rm -rf var/cache/*
Categories
Git

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/id_rsa.pub (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.

Solution

Critical command line to address the issue –

Ensure ssh-agent is enabled:

Start the ssh-agent in the background

eval "$(ssh-agent -s)"