Skip to content

Instantly share code, notes, and snippets.

View wagura-maurice's full-sized avatar
🏠
Working from home

Maurice Wagura wagura-maurice

🏠
Working from home
View GitHub Profile
<?php
namespace App\Console\Commands;
use App\Sms;
use App\Traits\AT;
use Illuminate\Console\Command;
class SmsCron extends Command
{
@wagura-maurice
wagura-maurice / remote_mysql.txt
Last active January 4, 2023 17:37
MySQL root access from all hosts
sudo ufw allow from any to any port 3306 proto tcp
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Rtcv39$$';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Rtcv39$$';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Rtcv39$$';
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
@wagura-maurice
wagura-maurice / generate-ssh-key.sh
Created May 9, 2020 21:51 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@wagura-maurice
wagura-maurice / phpenv-install.sh
Last active December 9, 2021 11:33
phpenv install shell
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
# Check OS.
# if [[ ! "${OSTYPE}" =~ "^linux" ]] || [[ ! "$(lsb_release -c 2>/dev/null)" =~ "xenial" ]]; then
# (>&2 echo "Error: This script is for Ubuntu 16.04 LTS (xenial) not '${OSTYPE}'.")
# exit 1;
# fi
sudo apt-get update
@wagura-maurice
wagura-maurice / minio.txt
Created November 22, 2019 14:15
minio-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-16-04
mysql_config_editor set --login-path=local --host=localhost --user=root --password
mysqldump --login-path=local --no-data --skip-triggers microfinance > microfinance.sql
mysqldump --login-path=local --no-create-db --no-create-info --skip-triggers microfinance >> microfinance.sql
mysqldump --login-path=local --no-create-db --no-create-info --no-data --routines --triggers --skip-opt microfinance >> microfinance.sql
@wagura-maurice
wagura-maurice / composer_memory.txt
Created November 14, 2019 11:53
Composer update runs out of memory
df -h
dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo 'echo "/swapfile none swap defaults 0 0" >> /etc/fstab' | sudo sh
free -m