Skip to content

Instantly share code, notes, and snippets.

@trongle
trongle / imagick-3.4.0-PHP7-forge.sh
Created November 26, 2020 09:10 — forked from pascalbaljet/imagick-3.4.0-PHP7-forge.sh
Install Imagick 3.4.0 on PHP 7.0 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
function include_files(string $path, $recursion = true)
{
$files = scandir($path);
foreach ($files as $fileName) {
if ($fileName == '.' || $fileName == '..') {
continue;
}
$file = "$path/$fileName";
function isIncludeRepeatlyCharacter(str, validNumberOfRepeat = 4) {
let matchesInr = 1;//The first occurrence of the character is 1.
let invalid = false;
for (let i = 0; i < str.length - 1; i++) {
str[i] == str[i+1] ? matchesInr++ : matchesInr = 1;
// console.log(str[i],'-', str[i+1], matchesInr);
if (matchesInr >= validNumberOfRepeat) {
invalid = true;