Skip to content

Instantly share code, notes, and snippets.

View andersonpem's full-sized avatar
💭
Always living and learning

AndersonPEM andersonpem

💭
Always living and learning
View GitHub Profile
@andersonpem
andersonpem / Dockerfile
Created December 18, 2019 03:41
Installing ZSH and oh-my-zsh on Laradock's workspace.
#Add zsh to the applications being installed
##...
libzip-dev zip unzip zsh \
# Change the shell of both users
USER root
RUN usermod --shell $(which zsh) laradock
RUN usermod --shell $(which zsh) root
#Install oh-my-zsh for both users
@andersonpem
andersonpem / .zshrc
Created December 20, 2019 00:12
Some useful Bash and ZSH aliases
# PHP - Laravel Related
alias pa="php artisan"
#Clears all cached assets in Laravel
alias paclear='php artisan cache:clear && php artisan config:clear && php artisan view:clear && composer dump-autoload'
# Linux Related
#APT Package Manager
#All upgrades in a single command add the flag -y for no confirmation needed
alias adg="sudo apt-get update && sudo apt-get upgrade"
#Install broken dependencies
@andersonpem
andersonpem / recomendacoesphp.md
Created August 31, 2020 13:57
Recomendações de permissões em servidores web PHP

Recomendações de permissões para servidores web PHP

É muito importante ter permissões próprias para os arquivos em um servidor web, para evitar escalada de permissões em arquivos e tomada de posse do sistema.

Portanto, seguem algumas recomendações que são boa prática utilizada pela comunidade web em servidores de produção:

## Usuário e grupo dos arquivos: www-data

sudo chown -R www-data:www-data /caminho/do/sistema
@andersonpem
andersonpem / executeorder66
Created May 9, 2022 09:47
Execute order 66 in your local Docker - Kills all containers, removes all volumes, removes ALL images. Clean slate Docker.
docker container stop $(docker container ls -aq) --force
docker container rm $(docker container ls -aq) --force
docker rmi $(docker images -aq) --force
docker volume prune --force
docker system prune --force
@andersonpem
andersonpem / flatpak_symlink.sh
Created May 23, 2022 09:45
Linux: Sublime Text 3 from Flatpak available as the subl command anywhere
@andersonpem
andersonpem / .env
Created August 6, 2023 17:10
A Doctrine (Symfony) master-replica database configuration
# SET YOUR ENVS :)
# Master Database Environment Variables
DATABASE_DRIVER=pdo_mysql
DATABASE_HOST=mysql-master-host
DATABASE_PORT=3306
DATABASE_NAME=app
DATABASE_USER=root
DATABASE_PASSWORD=root
DATABASE_SERVER_VERSION=8
@andersonpem
andersonpem / electon.js
Created March 4, 2024 11:54
Electron - prevent multiple instances of the program to spawn.
const { app, BrowserWindow } = require('electron');
// This should be placed at the top of your main process script
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
// If we don't get the lock, quit immediately as another instance is running
app.quit();
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
@andersonpem
andersonpem / README.md
Last active March 5, 2024 11:27
Fix: nordvpn doesn't connect on Linux, KDE, etc

Sometimes NordVPN doesn't work out of the box to connect to its services on Linux, especially on distros that use KDE. Or when some terminals like Terminator are the default. For some reason.

I debugged the issue and created a custom handler to get the job done. As well as a log writer.

You must have curl installed.

To run this script, go:

bash <(curl -s https://gist.githubusercontent.com/andersonpem/f58349b7f9bb4eca446f84298e92d8de/raw/41fb5f78b47dd4535a214e486e3be4c0b9cffe1d/runme.sh)
@andersonpem
andersonpem / README.md
Last active March 13, 2024 15:49
Fix: nordlayer doesn't connect on Linux, KDE, etc

Sometimes NordLayer doesn't work out of the box to connect to its services on Linux, especially on distros that use KDE. Or when some terminals like Terminator are the default. For some reason.

I debugged the issue and created a custom handler to get the job done. As well as a log writer.

You must have curl installed.

To run this script, go:

bash <(curl -s https://gist.githubusercontent.com/andersonpem/88f21e97ec6878aaea1ca892875f212b/raw/482c82ec01feb726de2d00075a3cbc4f93c861f5/runme.sh)