Skip to content

Instantly share code, notes, and snippets.

Avatar
😌
I may be slow to respond.

[BR]John_Magdy Zorono

😌
I may be slow to respond.
View GitHub Profile
View markdown-viewer.sh
#!/bin/bash
Args=$1
FileName="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
if [[ -n "$Args" ]]; then
if [[ -f $Args ]]; then
HTMLoutput=$(pandoc -s -f markdown -t html "$Args")
HTMLFileName="/tmp/tmp_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).html"
touch $HTMLFileName
@Zorono
Zorono / github-troll.md
Created Oct 27, 2020 — forked from lrvick/github-troll.md
Trolling Github's DMCA repo with their own security flaws.
View github-troll.md
View lazy-git.php
<?php
$ch = curl_init();
$_ERR_CODES = array(
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing...',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
@Zorono
Zorono / WebRequests.cs
Last active May 11, 2020 — forked from zmilojko/gist:5756502
Here is how you can make C# WebRequests asynchronously. The version on MSDN is overcomplicated and utterly sucks. This one is minimal and doesn't suck.
View WebRequests.cs
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Guoxun Yang and Zeljko Milojkovic wrote this file. As long as you retain this
* notice you can do whatever you want with this stuff. If we meet some day, and
* you think this stuff is worth it, you can buy us beer in return.
* ----------------------------------------------------------------------------
*/
using System;
@Zorono
Zorono / GITfix.bat
Created May 5, 2020
simple fix for Git Checkout `invalid path` error on Windows
View GITfix.bat
set "repo=https://github.com/Zorono/TestRepo.git"
git clone %repo%
git config core.protectNTFS false
git config hooks.enforcecompatiblefilenames false
git restore --source=HEAD :/
View dump_functions.php
<?php
function var_export_(array $arr)
{
if(is_array($arr))
{
if(count($arr) >= 1)
{
$result = 'array (';
foreach($arr as $key => $value)
{
@Zorono
Zorono / image_base64_encoding.php
Last active Sep 9, 2018
Image Base64 Encoding...(PHP)
View image_base64_encoding.php
<?php
$img_url = (preg_match('/\%[0-9A-F]{2}|\+/', $_GET['url']) !== False ? urldecode($_GET['url']) : $_GET['url']);
if($img_content = @file_get_contents($img_url))
{
if(strlen(mime_content_type($img_url)) > 2 ? strpos(mime_content_type($img_url), 'image/') !== False : True)
{
$_finfo = new finfo();
$img_mime = $_finfo->file($img_url, FILEINFO_MIME_TYPE);
echo '<img src="data:' .(isset($img_mime) && strlen($img_mime) > 2 ? $img_mime : "image/jpeg"). ';base64,' .base64_encode($img_content). '" />';
}
View simple-badge.css
.badge {
display:inline-block;
padding-left:8px;
padding-right:8px;
text-align:center;
border-radius:50%;
margin-left:16px;
background-color:rgba(255, 152, 0, 0.75);
color:rgb(255, 255, 255);
}
View unix-timelapse.php
<?php
function ReturnTimeLapse($start, $till)
{
$time = array(
'second' => $till - $start,
'minute' => 60,
'hour' => 60*60,
'day' => 60*60*24,
'month' => 60*60*24*30
);
View debug-config.php
<?php
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
ini_set('memory_limit', '250M');
set_time_limit(0);
error_reporting(E_ALL);
?>
You can’t perform that action at this time.