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 October 12, 2024 17:56
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 September 5, 2024 02:14
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 July 6, 2024 03:45
Ubuntu 22/24 - PHP development (php 7.4 / 8.3, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
@frosit
frosit / infectedFiles.md
Created May 5, 2016 22:40
Some commands for finding and clearing infected PHP files

Finding infected files with following bash commands

** Command to list all infected files:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
  • grep -lr --include=*.php "eval" .
  • grep -lr --include=*.php "base64" .

Command to remove malicious code:

  • grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
@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