Skip to content

Instantly share code, notes, and snippets.

View 5baddi's full-sized avatar
😎
Game changed!

Mohamed Baddi 5baddi

😎
Game changed!
View GitHub Profile
https://write.corbpie.com/installing-windows-10-pro-iso-with-virtio-on-vultr/
http://172.245.211.114/Win10Pro.iso
@5baddi
5baddi / safeHTMLHelper.php
Last active April 28, 2021 20:44
Prevent XSS from HTML
<?php
if (!function_exists('sanitize')) {
function sanitize(string $value): string
{
$safeValue = filter_var($value, FILTER_SANITIZE_STRING);
if(!$safeValue) {
return '';
}
@5baddi
5baddi / daemon.json
Created April 19, 2021 15:27
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,
@5baddi
5baddi / API.md
Created April 17, 2021 22:13 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@5baddi
5baddi / trelloinstall.sh
Created March 29, 2021 13:50 — forked from iPublicis/trelloinstall.sh
Install Trello Linux Client
#!/bin/bash
# Your system should be 64 bits and check if the last version at https://github.com/danielchatfield/trello-desktop/ is 0.19
# If the current version is not 0.19 change the file name below accordingly
wget https://github.com/Racle/trello-desktop/releases/download/v0.2.0/Trello-linux-0.2.0.zip -O trello.zip
sudo mkdir /opt/trello
sudo unzip trello.zip -d /opt/trello/
sudo ln -sf /opt/trello/Trello /usr/bin/trello
echo -e '[Desktop Entry]\n Version=1.0\n Name=Trello Desktop\n Exec=/usr/bin/trello\n Icon=/opt/trello/resources/app/static/Icon.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/trello.desktop
@5baddi
5baddi / get_youtube_channel_ID.php
Created December 7, 2020 12:52 — forked from webarthur/get_youtube_channel_ID.php
Get youtube Channel ID by channel url
<?php
function get_youtube_channel_ID($url){
$html = file_get_contents($url);
preg_match("'<meta itemprop=\"channelId\" content=\"(.*?)\"'si", $html, $match);
if($match && $match[1]);
return $match[1];
}
@5baddi
5baddi / youtube api video category id list
Created December 6, 2020 22:25 — forked from dgp/youtube api video category id list
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
@5baddi
5baddi / youtube_id_regex.php
Created December 6, 2020 21:33 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@5baddi
5baddi / array-validation-error-mapping.php
Created December 30, 2019 09:06 — forked from webmozart/array-validation-error-mapping.php
A little experiment: Validating (potentially multi-leveled) arrays with the Symfony2 Validator component and returning the errors in the same data structure as the validated array by using the Symfony2 PropertyAccess component.
<?php
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Constraints\Required;
<?php
namespace BADDI\SMP;
/**
* cURLHelper class
*/
class cURLHelper
{
/** Default cURL options */