Skip to content

Instantly share code, notes, and snippets.

View galvao's full-sized avatar
😎
Rocking to the rythm of the sure shot beat

Er Galvão Abbott galvao

😎
Rocking to the rythm of the sure shot beat
View GitHub Profile
@galvao
galvao / docker.outage.sh
Created April 6, 2025 18:13
Can't connect to docker socket after power outage?
sudo systemctl stop docker && \
docker context use default && \
sudo systemctl start docker
@galvao
galvao / laravel-setup.sh
Last active November 23, 2024 13:48
How to manually setup a laravel project on OpenSUSE Tumbleweed
composer global require laravel/installer && \
sudo ln -s ~/.config/composer/vendor/laravel/installer/bin/laravel /usr/local/bin/ && \
laravel new project-name && \ # This may yield an error about dependencies hence manually installing league/flysystem
# sudo zypper in php-fileinfo <- If not already installed
cd project-name && \
composer require league/flysystem && \
composer update && \
sudo chown -R user:wwwrun ../project-name && \
@galvao
galvao / Hydrator.js
Created November 17, 2024 19:15
A simple Hydrator in JS (ES6)
"use strict";
class Hydrator
{
#immutable;
fromEntity;
toEntity;
constructor (fromEntity, toEntity, lazy = true, immutable = true)
@galvao
galvao / devssh.sh
Last active November 9, 2023 18:48
Enables using a hardcoded password with ssh
#!/usr/bin/expect -f
# Requires: expect, spawn
spawn ssh-add
expect "Enter passphrase for /home/zaphod/.ssh/id_rsa:"
send "my_password"
interact
@galvao
galvao / convolutedCount.php
Created August 13, 2022 19:37
The most convoluted way of counting the entries in a collection?
<?php
/**
* Given a collection that implements the Iterator interface:
* @see https://www.php.net/manual/en/class.iterator
*/
return (int)!empty($collection->entries) * ($collection->key() + 1);
@galvao
galvao / factorialFactorial.php
Created May 26, 2022 02:34
Finding the factorial of a number, recursively
<?php
declare(strict_types = 1);
/**
* factorialFactorial
* Finding the factorial of a $number by recursion
*
* @author Er Galvão Abbott <[email protected]>
*/
@galvao
galvao / sshKeyCopy.sh
Created August 27, 2021 01:17
Copiando a chave ssh via terminal
sudo dnf -y update && sudo dnf -y install xclip && xclip -selection clipboard < ~/.ssh/NOME_DA_CHAVE.pub
@galvao
galvao / installVsCode.sh
Created August 18, 2021 14:27
Installing VsCode on Fedora
#! /usr/bin/bash
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
cat <<EOF | sudo tee /etc/yum.repos.d/vscode.repo
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
@galvao
galvao / lampInstall.sh
Created August 16, 2021 21:47
Installing a LAMP stack on Fedora
sudo dnf -y install httpd mariadb mariadb-server php-cli php-intl php-mbstring php-pdo php-sodium php-xml php-gd php-mysqlnd php-devel php-ffi php-fpm php-pear php-mbstring php-bcmath
@galvao
galvao / laravel54InstallWin.sh
Created May 11, 2021 16:25
Creating an older (5.4) Laravel on Windows' PowerShell, using one of php's version inside Laragon
C:\laragon\bin\php\php-7.2.19-Win32-VC15-x64\php C:\composer\composer.phar create-project --prefer-dist laravel/laravel C:\laragon\www\laravel54_example "5.4.*"