Skip to content

Instantly share code, notes, and snippets.

Georges Cubas Shagshag

Block or report user

Report or block Shagshag

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Shagshag
Shagshag / empty_folder.php
Created Oct 4, 2018
Delete all files and subfolders in the current folder
View empty_folder.php
<?php
/**
* Delete all files and subfolders in the current folder
* I use it to start a new project
* Be careful : There is no confirmation, this script deletes everything it can, including itself
*/
// https://stackoverflow.com/a/17161106/2530962 php glob - scan in subfolders for a file
function rglob($pattern, $flags = 0) {
$files = (array) glob($pattern, $flags);
@Shagshag
Shagshag / wp_logtoadmin.php
Created May 25, 2018
This script allows to login to WordPress without password. Put it on the root of your blog by FTP then visit the URL http://yourblog/wp_logtoadmin.php
View wp_logtoadmin.php
<?php
/**
* 1. Change the password below, it's encoded with m5d https://duckduckgo.com/?q=md5+toto
* 2. Put this file at the root of your shop
* 3. Visit the URL http://yourblog/wp_logtoadmin.php
**/
$auth_pass = "f71dbe52628a3f83a77ab494817525c6"; //toto
// display login screen
if (!isset($_POST['pass'])
@Shagshag
Shagshag / netinstall.php
Last active May 3, 2018
WordPress netinstall : This script download and unzip the latest version of WordPress
View netinstall.php
<?php
// This script download and unzip the latest version of WordPress
//
// Put this file in the folder where you want to install WordPress
// Visit it with your browser
// Follow the installation process
$path = dirname(__FILE__);
$local_file = $path.'/latest.zip';
$remote_file = 'https://wordpress.org/latest.zip';
@Shagshag
Shagshag / delete_presta.php
Last active Mar 16, 2018
Delete a PrestaShop installation. Put it by FTP in the PrestaShop root folder and open it in a browser. ⚠ it deletes all files in the PrestaShop folder and all table with the PrestaShop prefix. ⚠⚠ It doesn't ask confirmation
View delete_presta.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$root = dirname(__FILE__);
$server = false;
$user = false;
$password = false;
$database = false;
View tumbler-gist-insert.html
<script src="//static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script type="text/javascript">
$(function() {
$("a[href]").each(
function(index, element) {
if ( $(element).text().indexOf('gist.github.com') > 0 ) {
var divElement = $('<div></div>');
$(element).after(divElement);
writeCapture.html(divElement, '<script src="'+$(element).text()+'.js"></'+'script>');
@Shagshag
Shagshag / replace_bad_encoding_rubbishes.sql
Created Dec 13, 2017
Replace bad encoding rubbishes like é by UTF-8 characters
View replace_bad_encoding_rubbishes.sql
UPDATE table SET field = REPLACE(field, CAST(_latin1'à' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'à');
UPDATE table SET field = REPLACE(field, CAST(_latin1'é' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'é');
UPDATE table SET field = REPLACE(field, CAST(_latin1'è' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'è');
UPDATE table SET field = REPLACE(field, CAST(_latin1'ê' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'ê');
UPDATE table SET field = REPLACE(field, CAST(_latin1'ù' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'ù');
UPDATE table SET field = REPLACE(field, CAST(_latin1'ç' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'ç');
UPDATE table SET field = REPLACE(field, CAST(_latin1'ë' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'ë');
UPDATE table SET field = REPLACE(field, CAST(_latin1'ô' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'ô');
UPDATE table SET field = REPLACE(field, CAST(_latin1'â' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin, 'â');
UPDATE table SET field = REPLACE(field, CAST(_latin1
@Shagshag
Shagshag / rotateFTP.sh
Created Nov 15, 2017
Delete files older than X days on FTP. use curlftpfs
View rotateFTP.sh
#!/bin/bash
ftpuser="x"
ftppass="x"
ftpsite="x"
ndays=10
# https://stackoverflow.com/a/34676160/2530962
# the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
View keybase.md

Keybase proof

I hereby claim:

  • I am shagshag on github.
  • I am shagshag (https://keybase.io/shagshag) on keybase.
  • I have a public key whose fingerprint is DBC5 F300 736E 061A BB97 3161 F4CD E46E 1A49 C659

To claim this, I am signing this object:

View cron.php
<?php
class BackupDatabaseCronModuleFrontController extends ModuleFrontController
{
public function init()
{
$this->module->cron();
die();
}
}
View sd_addshippingnumber.php
<?php
/**
* Add Shipping Number module
*
* @category Prestashop
* @category Module
* @author Samdha <contact@samdha.net>
* @copyright Samdha
* @license commercial license see license.txt
*
You can’t perform that action at this time.