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
composer global require laravel/installer
composer global require cpriego/valet-linux
nano ~/.bashrc
export PATH="$PATH:~/.config/composer/vendor/bin"
source ~/.bashrc
@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
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
@wagura-maurice
wagura-maurice / postman.desktop
Last active November 27, 2019 07:57
Setting up Postman on Ubuntu 18.04
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/home/montanabay/Postman/files/Icons/icon.png
Terminal=false
Type=Application
Categories=Development;
@wagura-maurice
wagura-maurice / postman_install.sh
Last active November 27, 2019 07:41
Installing Postman on Ubuntu 18.04
#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman
@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
@wagura-maurice
wagura-maurice / gist:e985733d5a6829b03b77ea73738707e9
Created October 15, 2019 13:17
Nginx Redirect Mobile / Smart Phone Traffic To Mobile Version Of the Web Site
server {
server_name server_name example-live.com www.example-live.com;
set $mobile_rewrite do_not_perform;
# this regex string is actually much longer to match more mobile devices
if ($http_user_agent ~* "|android|ip(ad|hone|od)|kindle") {
set $mobile_rewrite perform;
}
@wagura-maurice
wagura-maurice / replace_string.md
Created October 1, 2019 23:39
How to replace a string in multiple files in linux command line

Similar to Kaspar's answer but with the g flag to replace all the occurrences on a line.

find ./ -type f -exec sed -i 's/string1/string2/g' {} ;

For global case insensitive:

find ./ -type f -exec sed -i 's/string1/string2/gI' {} ;

In case your string has a forward slash(/) in it, you could change the delimiter to '+'.

find . -type f -exec sed -i 's+http://example.com+https://example.com+g' {} +