Skip to content

Instantly share code, notes, and snippets.

View Zorono's full-sized avatar
😌
I may be slow to respond.

John Magdy Lotfy Kamel Zorono

😌
I may be slow to respond.
View GitHub Profile
@zmilojko
zmilojko / gist:9343394
Last active May 11, 2020 03:05
C# XML (de)serialization made simple. I am sick of C# approach to use 12 lines of code where one would suffice. These two functions will (de)serialize string <=> object and with nice format two.
string Serialize(object o)
{
XmlWriterSettings Settings = new XmlWriterSettings()
{
Indent = true,
IndentChars = " ",
NewLineHandling = NewLineHandling.None,
NewLineChars = "\n",
};
var sb = new StringBuilder();
@zmilojko
zmilojko / gist:5756502
Last active May 11, 2020 03:09
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.
/*
* ----------------------------------------------------------------------------
* "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;
@navio
navio / ProxyEngine.js
Last active August 10, 2020 15:23
Browser Proxy - Overwriting Fetch / XMLHTTPRequest
function ProxyEngine(initialRules = []) {
const storedRules = JSON.parse((localStorage.getItem(keyStorage) || '[]'));
const rules = new Map([...initialRules, ...storedRules]);
const matchRules = (url,response) => {
const element = [...rules.keys()].find((rule) => url.indexOf(rule) > 1);
if (element){
const rule = rules.get(element);
@HellGamer
HellGamer / ogpdebian8.txt
Created November 11, 2016 12:12
Easy Installer For Open Game Panel Debian 8 Version
OGP Agent Installation
sudo apt-get install libxml-parser-perl libpath-class-perl perl-modules screen rsync sudo e2fsprogs unzip subversion libarchive-extract-perl pure-ftpd libarchive-zip-perl libc6 libgcc1
sudo apt-get install libc6-i386 lib32gcc1
sudo apt-get install libhttp-daemon-perl
OGP AGENT
wget -N "http://sourceforge.net/projects/ogpextras/files/Easy-Installers/ogp-agent-latest.deb/download" -O "ogp-agent-latest.deb"
sudo dpkg -i "ogp-agent-latest.deb"
sudo cat /root/ogp_user_password
<?php
$name = Trim(stripslashes($_POST['name']));
$email = Trim(stripslashes($_POST['email']));
$message = Trim(stripslashes($_POST['message']));
// validation
$validationOK=true;
if (!$validationOK) {
@InsiderJanggo
InsiderJanggo / upload.php
Created July 7, 2020 00:50
A Simple Upload script
<?php
// retrieve data file
$filename = $_FILES['berkas']['name'];
$tempname = $_FILES['berkas']['tmp_name'];
//specify the location of the file to be moved
$dirUpload = "terupload/";
// move the file
@bennadel
bennadel / app.js
Created April 6, 2017 12:37
Tracking Static Asset Request Duration In Express.js And Node.js
// Require our core node modules.
var bodyParser = require( "body-parser" );
var chalk = require( "chalk" );
var cookieParser = require( "cookie-parser" );
var express = require( "express" );
var onFinished = require( "on-finished" );
var path = require( "path" );
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
#define FILTERSCRIPT
#include <a_samp>
#include <colandreas>
new pBall;
new
Float:InGameX = 0.7,
Float:InGameY = 0.525,
@ryanwinchester
ryanwinchester / ip_in_range.php
Last active March 15, 2021 18:25 — forked from tott/ip_in_range.php
php check if IP is in given network range
<?php
/**
* Check if a given ip is in a network.
*
* @see https://gist.github.com/ryanwinchester/578c5b50647df3541794
*
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed