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
@bearroast
bearroast / gist:3880174
Created October 12, 2012 16:43
Font smoothing
body {
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-webkit-text-size-adjust: 100%;
}
@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
@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
@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
@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'
@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
@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">
@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
@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();
@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