Skip to content

Instantly share code, notes, and snippets.

View mrl22's full-sized avatar
💭
Always coding

Richard Leishman mrl22

💭
Always coding
View GitHub Profile
@cagartner
cagartner / deploy.sh
Last active April 29, 2024 15:30
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master
@MarcoCestari
MarcoCestari / automatic-ssl.md
Created August 20, 2019 18:59
Automatic SSL - Multi Tenant

Tutorial from: https://www.storyblok.com/tp/automatic-ssl-multi-tenant

Starting a Amazon EC2 instance

First we choose a EC2 instance with Amazon Linux and create it with the default settings.

Amazon Ec2 instance

Copy the IPv4 Public IP from the EC2 instance dashboard and connect to your instance using your private key.

@LukeWJensen
LukeWJensen / mysql_user_management.sql
Created May 10, 2019 18:00
[Mysql Database and User Management] #mysql #database
--CREATE DATABASE
CREATE DATABASE db_name;
--SHOW USERS
SELECT User FROM mysql.user;
--DELETE USERS
DROP USER 'user_name'@'localhost';
--CREATE USER
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active January 24, 2024 13:40
Laravel: Use progress bars in migrations
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@brendonexus
brendonexus / pagination.php
Created June 30, 2017 07:49 — forked from mrl22/pagination.php
Pagination that can be used on any website in bootstrap format
/**
* @param int $total Total number of records
* @param int $per_page How many records to display per page
* @param int $current_page Current page number
* @param string $link sprintf formatted string for page links $1 = page number
* @return string in html ul-li format
*/
function pagination($total, $per_page, $current_page, $link)
{
$boundry = 3; // How many pages to show around the current page
@mrl22
mrl22 / gist:866408b446ce91ba483c954ac69cd383
Last active October 31, 2019 23:20 — forked from brendonexus/Bootstrap 4 Visible Style
Bootstrap 4 Visible Style
<div class="d-block d-sm-none">
visible XS
</div>
<div class="d-none d-sm-block d-md-none">
visible SM
</div>
<div class="d-none d-md-block d-lg-none">
visible MD
</div>
<div class="d-none d-lg-block d-xl-none">
@ankurk91
ankurk91 / install_lamp_ubuntu.sh
Last active May 1, 2024 05:03
Ubuntu 22 - PHP development (php 7.4 / 8.2, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 20/22 dev Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
@mariancerny
mariancerny / crontab
Last active March 18, 2023 16:15
Scripts to perform ZFS hourly, daily and monthly backups using ZFS snapshot feature.
# ZFS Backups
3 0 * * * root sh /opt/sbin/zfs-backup.sh
2 1-23 * * * root sh /opt/sbin/zfs-backup-hourly.sh
33 10 9 * * root sh /opt/sbin/zfs-backup-monthly.sh
@marsam
marsam / ftpmirror
Last active April 3, 2018 17:00
ftp mirror
#!/usr/bin/env bash
set -e
host="ftp.example.com"
user="user"
pass="pasword"
ftpurl="ftp://${user}:${pass}@${host}"
local_dir="/path/to/local/dir"
remote_dir="documents" # Only mirror this remote dir
@haad
haad / gist:5904725
Created July 1, 2013 21:19
File level dedup with rsync
# from http://ask.slashdot.org/comments.pl?sid=2604202&cid=38589562
# First I sync from the remote directory to a local base directory:
rsync --partial -z -vlhprtogH --delete root@www.mydomain.net:/etc/ /backup/server/www/etc/base/
#Then I sync that to the daily backup. Files that have not changed are hard-linked between all the days that share them. It very efficient and simple, and retrieving files is as simple as doing a directory search.
rsync -vlhprtogH --delete --link-dest=/backup/server/www/etc/base/ /backup/server/www/etc/base/ /backup/server/www/etc/2012-01-04