Skip to content

Instantly share code, notes, and snippets.

View MattLoyeD's full-sized avatar
🌮
Cooking

Matthieu D MattLoyeD

🌮
Cooking
View GitHub Profile
@MattLoyeD
MattLoyeD / super_backup.php
Last active January 29, 2016 18:11
Local to ftp backup (sql & files, limited by local or ftp timestamp or folder/file sizes).
<?php
$conf = array(
"backup_prefix" => "bc-",
"backup_dir" => dirname(__FILE__).'/backups/',
"backup_files" => true,
"backup_target_dir" => '/folder',
"keep_local_files" => true,
"local_backup_size_limit" => "80GB", // in what you want, like 1GB or 2MB
"local_backup_time_limit" => 7, // in days, 0 for no limit
@MattLoyeD
MattLoyeD / cron_mp3.sh
Created October 28, 2015 15:19
Copy new music files to a folder
#!/bin/bash
extarray=( mp3 flac ogg wmv wav ) ;
HOME=$1;
DESTINATION=$2;
#if [ $HOME == "/" || $HOME == $DESTINATION ] { exit 1 }
cd $HOME;
@MattLoyeD
MattLoyeD / clamav_autoscan.sh
Last active October 28, 2015 15:17
Clamav autoscan + Email alert
#!/bin/bash
# Usage "sh script.sh /path/to/check"
if [ -z "$1" ]; then
vir_dir="`./virus`"
else
vir_dir="$1"
fi
[email protected];
@MattLoyeD
MattLoyeD / substr_paragraph.php
Last active August 29, 2015 14:27
Easy substr for paragraph in PHP
<?php
function substr_paragraph($string, $length = 520, $html = false) {
$pos = strpos($string, "</p>",$length);
$tag_len = 4;
if(empty($pos)){
$pos = strpos($string, "</div>",$length);
$tag_len = 5;
@MattLoyeD
MattLoyeD / remove_from_git_based_on_gitignore.sh
Created July 21, 2015 23:56
Remove files from git based on gitignore
git ls-files -i -z --exclude-from=.gitignore | xargs -0 git rm --cached
@MattLoyeD
MattLoyeD / cron_backup_s3.sh
Created July 21, 2015 13:15
Backup your files and DB to S3
#!/bin/bash
#-------------------- Config vars -------------------#
S3_BUCKET=your_s3_bucket
# Files
BACKDIR=~/backups
BACKTARGET=~/files
@MattLoyeD
MattLoyeD / easy_serv_installer.sh
Last active January 7, 2017 12:53
Easy Mooty Web Server Setup (Ubuntu)
###
#
# Easy Mooty Server installer
#
# wget http://gist.github.com/script_name.sh
# sudo sh script_name.sh
#
###
# Funcs #
@MattLoyeD
MattLoyeD / kill_screens.sh
Created July 19, 2015 22:38
Kill all screen detached sessions
#!/bin/sh
# This line kills everething, be carefull, maybe do a screen -ls first to watch what is running
screen -ls | grep -o '[0-9]*\.[a0-Z9]*' | while read -r v ; do screen -X -S $v quit; done
<?php
ini_set("allow_url_fopen", "1");
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
// Put your API Key here
$api_key = "";
$state_in_transit = Configuration::get('PS_OS_SHIPPING');
<?php
// Add to functions.php
add_action('login_head', 'custom_wp_login_logo');
function custom_wp_login_logo() {
echo '<style type="text/css">
h1 a {
background-image:url('. get_bloginfo( 'template_directory' ) .'/img/logo_backoffice.jpg) !important;