Skip to content

Instantly share code, notes, and snippets.

View MahefaAbel's full-sized avatar
🏠
Working from home

Mahefa Abel MahefaAbel

🏠
Working from home
View GitHub Profile
@MahefaAbel
MahefaAbel / http-status-codes.php
Created September 8, 2021 17:06 — forked from henriquemoody/http-status-codes.php
List of HTTP status codes in PHP
<?php
/**
* Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
*
* You may also want a list of unofficial codes:
*
* 103 => 'Checkpoint',
* 218 => 'This is fine', // Apache Web Server
* 419 => 'Page Expired', // Laravel Framework
@MahefaAbel
MahefaAbel / docker.memo.sh
Last active December 7, 2021 19:55
docker.memo.sh
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 -v sonarqube:/opt/sonarqube/data sonarqube
docker run -d -u zap -i owasp/zap2docker-stable zap.sh -p 8090:8090
docker run -i owasp/zap2docker-stable zap-cli quick-scan --self-contained --start-options '-config api.disablekey=true' http://localhost
docker run -d -u zap -p 8080:8080 -p 8090:8090 -i owasp/zap2docker-stable zap-webswing.sh
http://localhost:8080/zap
docker start sonarqube
@MahefaAbel
MahefaAbel / Guzzle-requestAsync.php
Last active February 7, 2022 10:32
postWithoutWait.php
<?php
$client = new GuzzleHttp\Client();
$promise = $client->requestAsync('GET', 'http://httpbin.org/get');
$promise->then(
function (ResponseInterface $res) {
echo $res->getStatusCode() . "\n";
},
function (RequestException $e) {
echo $e->getMessage() . "\n";
@MahefaAbel
MahefaAbel / override-default-charset.sh
Last active February 8, 2022 08:13
Java Charseting
Can We Override the Default Charset?
-Dfile.encoding="UTF-8"
-Dsun.jnu.encoding="UTF-8"
java -Dfile.encoding=utf-8 -jar target\application.jar
@MahefaAbel
MahefaAbel / SQL requette - myteknow RG.sql
Created February 25, 2022 07:24
SQL requette - myteknow
-- ----------------------------------------------------------------
DROP FUNCTION IF EXISTS getIdEntrepriseFromPrestation; DELIMITER //
CREATE FUNCTION getIdEntrepriseFromPrestation(id_post_prestation INT) RETURNS INT BEGIN
DECLARE idEntreprise INT;
SELECT pm.meta_value INTO idEntreprise FROM wp_612371_postmeta pm INNER JOIN wp_612371_posts p ON p.ID=pm.post_id
WHERE p.post_type = "prestation" AND pm.meta_key = "Entreprise" AND p.ID=id_post_prestation;
RETURN idEntreprise;
END // DELIMITER ;
SELECT getIdEntrepriseFromPrestation(74511);
@MahefaAbel
MahefaAbel / FirebaseMessaging-Flutter.dart
Created March 17, 2022 08:51
Firebase Cloud Messaging for Flutter
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
_firebaseMessaging.configure(
onLaunch: (Map<String, dynamic> message) {
print('onLaunch called');
},
onResume: (Map<String, dynamic> message) {
print('onResume called');
},
onMessage: (Map<String, dynamic> message) {
print('onMessage called');
@MahefaAbel
MahefaAbel / chroot-predator.sh
Last active February 6, 2023 11:52
Chroot Predator + Bootable manipulation Grub + Graphic Driver
mount /dev/sdb5 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /boot /mnt/boot
mount -t proc /proc /mnt/proc
mount -t sysfs /sys /mnt/sys
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do
# mkdir /mnt/$dir && \
@MahefaAbel
MahefaAbel / switch-php.sh
Last active May 9, 2022 07:02
Switch php
sudo a2dismod php5.6
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
# sudo update-alternatives --set phpize /usr/bin/phpize7.2
# sudo update-alternatives --set php-config /usr/bin/php-config7.2
@MahefaAbel
MahefaAbel / install-phpmyadmin.sh
Last active May 9, 2022 07:14
install-phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.10/phpMyAdmin-4.9.10-all-languages.zip
unzip phpMyAdmin-4.9.10-all-languages.zip
sudo mv phpMyAdmin-4.9.10-all-languages/ /usr/share/phpmyadmin
sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R www-data:www-data /var/lib/phpmyadmin
sudo mkdir /etc/phpmyadmin/
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
@MahefaAbel
MahefaAbel / start-new-instance-chrome.sh
Created May 9, 2022 07:24
start-new-instance-chrome
mkdir /tmp/chrome2
google-chrome --user-data-dir=/tmp/chrome2/