Skip to content

Instantly share code, notes, and snippets.

View bm2ilabs's full-sized avatar
🎯
Focusing

Boukraa Mohamed bm2ilabs

🎯
Focusing
View GitHub Profile
@bm2ilabs
bm2ilabs / gist:ce35123c6ac73adf37fe7d148e4ceed0
Created August 4, 2021 08:33
Regular Expression for Algerian Phone number
^(00213|\+213|0)[(2)[0-9]{7}|(|5|6|7|9)[0-9]{9}]$
@bm2ilabs
bm2ilabs / DigitalOcean
Last active March 25, 2020 11:05
DigitalOcean Vs Linode Vs Vultr 2020 8GB/4 CPU/Germany
## CPU
[root@srv1 ~]# sysbench --test=cpu --cpu-max-prime=20000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
@bm2ilabs
bm2ilabs / install_lamp_18.sh
Created January 15, 2020 21:51 — forked from ankurk91/install_lamp_ubuntu.sh
Ubuntu 18.04 - PHP development (php 7.3, MySQL 5.7, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 18.04 dev Server
# Run like - bash install_lamp.sh
# Script should auto terminate on errors
echo -e "\e[96m Adding PPA \e[39m"
sudo add-apt-repository -y ppa:ondrej/apache2
@bm2ilabs
bm2ilabs / AuthServiceProvider.php
Created November 19, 2019 10:40 — forked from roquie/AuthServiceProvider.php
Laravel 5.6 Cartalyst Sentinel Integration
<?php
declare(strict_types=1);
namespace App\Providers;
use Auth;
use Domain\SentinelGuard;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
@bm2ilabs
bm2ilabs / Breakpoints
Created September 26, 2019 04:20 — forked from janily/Breakpoints
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@bm2ilabs
bm2ilabs / assertSeeLinkWithHref.php
Created August 26, 2019 08:47
Find link with href Dusk
<?php
Browser::macro('assertSeeLinkWithHref', function ($link, $href) {
$message = "Did not see expected link [{$link}] with href [{$href}].";
if ($this->resolver->prefix) {
$message .= " within [{$this->resolver->prefix}].";
}
$anchor = $this->resolver->find("a[href$='{$href}']");
$hasText = $anchor && (strpos($anchor->getText(), $link) !== false);
PHPUnit::assertTrue($anchor && $hasText, $message);
@bm2ilabs
bm2ilabs / assertFind.php
Last active August 26, 2019 08:49
Check if selector exist Dusk Testing
<?php
use Laravel\Dusk\Browser;
use PHPUnit\Framework\Assert as PHPUnit;
Browser::macro('assertFind', function ($dom) {
$message = "Did not see expected element [{$dom}].";
if ($this->resolver->prefix) {
$message .= " within [{$this->resolver->prefix}].";
}
@bm2ilabs
bm2ilabs / explode.php
Created August 19, 2019 09:52
explode new line to array
<?php
explode(PHP_EOL, $string);
@bm2ilabs
bm2ilabs / gen-statistics.sh
Created April 17, 2019 07:38 — forked from zeehio/gen-statistics.sh
Generate HTML page with CPU, RAM, and disk usage information for several SSH servers.TODO: There are too many SSH connections per server. Fixing that would speed up a lot the HTML generation.
#!/bin/bash
# Shell script to get disk usage, cpu usage, RAM usage,system load,etc.
# from multiple Linux servers and output the information on a single
# server in html format. Read below for usage/installation info
# *--------------------------------------------------------------------*
# * ORIGINAL WORK BY:
# * dig_remote_linux_server_information.bash,v0.1
# * Last updated on 25-Jul-2005*
# * Copyright (c) 2005 nixCraft project *
# * Comment/bugs: http://cyberciti.biz/fb/ *
Add this to your http {} of the nginx.conf file normally located at /etc/nginx/nginx.conf:
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
Then add this to your php location block, this will be located in your vhost file look for the block that begins with location ~ .php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;