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 / 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 / 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 / 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 / rename-remove-{pre|su}fix.sh
Last active September 2, 2021 05:16
Linux - Rename files or folders suffix or prefix
for file in *_; do mv -i $file `basename $file _`;done;
@MahefaAbel
MahefaAbel / docker-compose.yml
Created August 28, 2021 10:46 — forked from sheikhwaqas/docker-compose.yml
Docker Compose configuration to run MySQL 5.6 and MySQL 5.7 on one instance. Create /var/lib/mysql56-data & /var/lib/mysql57-data with root as the owner of these directories before running docker-compose up -d
version: '3'
services:
mysql56:
image: mysql:5.6
restart: unless-stopped
container_name: mysql56-container
ports:
- "127.0.0.1:3356:3306"
environment:
MYSQL_ROOT_PASSWORD: rootPassword
@MahefaAbel
MahefaAbel / vsCodeOpenFolder.reg
Last active December 14, 2023 03:27
vsCodeOpenFolder.reg
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@MahefaAbel
MahefaAbel / clear-reset-console
Created March 5, 2021 14:33
Clear / reset Console for Node.js
Node.js — Clear/reset Terminal / Console.
# Method 1 (My favorite)
process.stdout.write('\x1Bc');
# Method 2
console.clear();
# Method 3
const readline = require('readline')
[Thumbnailer Entry]
TryExec=/usr/bin/gdk-pixbuf-thumbnailer
Exec=/usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
MimeType=image/png;image/bmp;image/x-bmp;image/x-MS-bmp;image/gif;image/x-icon;image/x-ico;image/x-win-bitmap;image/vnd.microsoft.icon;application/ico;image/ico;image/icon;text/ico;application/x-navi-animation;image/jpeg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/tiff;image/x-xpixmap;image/x-xbitmap;image/x-tga;image/x-icns;image/x-quicktime;image/qtif;image/x-3fr;image/x-adobe-dng;image/x-arw;image/x-bay;image/x-canon-cr2;image/x-canon-crw;image/x-cap;image/x-cr2;image/x-crw;image/x-dcr;image/x-dcraw;image/x-dcs;image/x-dng;image/x-drf;image/x-eip;image/x-erf;image/x-fff;image/x-fuji-raf;image/x-iiq;image/x-k25;image/x-kdc;image/x-mef;image/x-minolta-mrw;image/x-mos;image/x-mrw;image/x-nef;image/x-nikon-nef;image/x-nrw;image/x-olympus-orf;image/x-orf;image/x-panasonic-raw;image/x-panasonic-raw2;image/x-pef;image/x-pentax-pef;image/x-ptx;image
@MahefaAbel
MahefaAbel / iptables-config-script
Created October 4, 2019 12:23 — forked from LouWii/iptables-config-script
Bash script to configure iptables for a web server. Some rules can be removed depending on used services.
#!/bin/sh
# Empty all rules
sudo iptables -t filter -F
sudo iptables -t filter -X
# Bloc everything by default
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
@MahefaAbel
MahefaAbel / web-service-soap-client-server-php.md
Created April 29, 2019 05:45 — forked from umidjons/web-service-soap-client-server-php.md
Simple Web service - SOAP Server/Client in PHP

Simple Web service - SOAP Server/Client in PHP

Implementation of the SOAP server - server.php:

<?php
// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled","0");

// model, which uses in web service functions as parameter