This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a new user (john for this example) | |
# just enter a password when asked, confirm it, and the other steps are optionals | |
sudo adduser john | |
# give root user the ownership of john's home directory | |
sudo chown root:root /home/john | |
# edit the ssh configuration file | |
sudo vim /etc/ssh/sshd_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Given a string $haystack, search if it contains the string $needle and return | |
* true or false. Return false if $haystack or $needle is empty. | |
* | |
* @param string $haystack | |
* @param string $needle | |
* @return bool | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
/** | |
* MY_Model class. | |
* | |
* @extends CI_model | |
*/ | |
class MY_Model extends CI_model { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function starts_with($haystack, $needle) { | |
// search backwards starting from haystack length characters from the end | |
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false; | |
} | |
function ends_with($haystack, $needle) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Paste all this SQL script in phpMyAdmin (SQL tab) ## | |
## WARNING: DON'T PUT ANY TRAILING SLASH AT THE END OF THE URL ## | |
# CHANGE WEBSITE URL | |
UPDATE wp_options | |
SET option_value = REPLACE(option_value, 'http://www.oldwebsite.fr', 'http://www.newwebsite.fr') | |
WHERE option_name = 'home' | |
OR option_name = 'siteurl'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* get_string_between function. | |
* | |
* Given a string ($string) and two delimiters ($start and $end), this function | |
* returns the substring between $start and $end. $start and $end are also | |
* removed. | |
* | |
* @link http://www.justin-cook.com/wp/2006/03/31/php-parse-a-string-between-two-strings/ |