Skip to content

Instantly share code, notes, and snippets.

View franckweb's full-sized avatar

Franck Mercado franckweb

  • Globant
  • Cusco, Perú
View GitHub Profile
@franckweb
franckweb / pull-request-template.md
Created May 3, 2024 16:24
Pull Request Template

Description

Include a technical summary of the code update.

Unit Tests

[x] added unit test [x] executed all unit tests in DEV env [x] added PHPUnit groups to facilitate unit tests execution

QA

[x] conducted basic QA in TEST/DEV envs

@franckweb
franckweb / tmux.md
Last active March 8, 2024 17:57
Tmux shortcuts

install (ubuntu)

apt-get install tmux

add following to ~/.tmux.conf (create file)

set-option -g default-shell /bin/zsh
set -g mouse on
bind e set-window-option synchronize-panes

then run command

@franckweb
franckweb / linux-commands.md
Last active January 4, 2024 17:03
Useful commands

stop/start snap constant updates

snap refresh --hold snap refresh --unhold

copy files with specific extension to new directory

find . -name *.php -exec cp {} newDirectory ;

rsync

rsync -vzcrSLhp --exclude="deploy.sh" ./ deploy-ex:/var/www/site

@franckweb
franckweb / backups.sh
Last active October 11, 2023 20:33 — forked from dinhkhanh/backup-restore-mysqldump-cli.sh
Backup Files & Databases
#
# BACKUP FILES
# sources:
# https://tonyteaches.tech/rsync-backup-tutorial/
# https://www.nexcess.net/help/using-rsync-for-backups/
#
# daily
tar -zcf /home/tony/backup/daily/backup-$(date +%Y%m%d).tar.gz /home/website/public_html
find /home/tony/backup/daily/* -mtime +7 -delete
@franckweb
franckweb / git-commands.sh
Last active April 12, 2023 15:48
Git commands
## zsh git aliases
https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet
## stash files for later
# add files to stash
git stash push -m "mystash"
# use specific stash
# use by number (n)
@franckweb
franckweb / docker-commands.sh
Last active March 21, 2023 02:32
Docker commands
## Add current logged in linux user to docker group
1. sudo usermod -aG docker ${USER}
# To apply the new group membership, log out of the server and back in, or type the following:
2. su - ${USER}
# You will be prompted to enter your user’s password to continue.
# Confirm that your user is now added to the docker group by typing:
3. groups
@franckweb
franckweb / javascript-promise.js
Last active December 21, 2022 21:29
Javascript Promise
const myMethod = function () {
const promise = new Promise(function (resolve, reject) {
const result = null;
const y = "geeksforgeeks";
if (result !== null) {
resolve(result);
} else {
reject("Error");
}
});
@franckweb
franckweb / renew-lets-encrypt.sh
Created October 27, 2022 23:07
Renew Lets Encrypt with certbot
#
# renews lets encrypt on a running server
# note: not ideal as it stops/renews nginx for a few millisecs
#
sudo certbot certonly --standalone --pre-hook "service nginx stop" --post-hook "service nginx restart" -d mydomain.com -d www.mydomain.com
@franckweb
franckweb / php-compatibility-checker.sh
Last active October 21, 2022 13:10
PHP compatibility check
# PHP COMPATIBILITY CHECK
# PHP CODE SNIFFER (with compatibility 7.4)
docker run --rm -v $(pwd):/app vfac/php7compatibility 7.4 [folder or file path] --extensions=php --ignore=vendor
# -------
# PHPSTAN (with .neon configs)
@franckweb
franckweb / Mailer.php
Created July 6, 2022 13:25
Form Submission with Validation and Email Delivery through SMTP
<?php
namespace App;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
class Mailer
{
private $client;