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
@Zorono
Zorono / datebirth.php
Last active October 4, 2019 22:28
It calculates the Age with full detailes (Y/M/H/m/s/ms/ns/ms) in PHP by Date of Birth with the following Syntax: Year-Month-Day
<?php
$daofbi = array('year' => 2002, 'month' => 9, 'day' => 16);
$aprox_age = (date("Y") - date("Y", strtotime(join('-', $daofbi))));
$BDToday = (bool)($daofbi['year'] == date("Y") || $daofbi['month'] == date("m"));
$Username = "[BR]John_Magdy";
echo 'Age(approximate): ' .$aprox_age. '<br />';
$dabi = new DateTime(join('-', $daofbi), new DateTimeZone(date_default_timezone_get()));
$today = new DateTime("now", new DateTimeZone(date_default_timezone_get()));
echo 'Age(specifically): ' .$today->diff($dabi)->format('%y Years, %m Months, %d Days, %h Hours, %I Minutes, %s Seconds, ' . ($today->diff($dabi)->format('%s')*1000) . ' Milliseconds, ' . ($today->diff($dabi)->format('%s')*1000*1000000) . ' Nanoseconds, ' . ($today->diff($dabi)->format('%s')*1000*1000) . ' Microseconds');
echo '<br />Day of Birth: ' .$dabi->format('D');
@Zorono
Zorono / GITfix.bat
Created May 5, 2020 22:56
simple fix for Git Checkout `invalid path` error on Windows
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 :/
@Zorono
Zorono / WebRequests.cs
Last active May 11, 2020 03:11 — 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.
/*
* ----------------------------------------------------------------------------
* "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 / github-troll.md
Created October 27, 2020 22:41 — forked from lrvick/github-troll.md
Trolling Github's DMCA repo with their own security flaws.
<?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 / .bash_aliases
Created December 24, 2021 01:42 — forked from vratiu/.bash_aliases
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@Zorono
Zorono / download_page_photos.py
Created January 29, 2022 19:34 — forked from pcardune/download_page_photos.py
Download Facebook Page Photos
#!/usr/bin/env python
import os.path
import os
from urllib import urlretrieve
import imp
print "starting up, hang with me..."
urlretrieve('https://raw.github.com/facebook/fbconsole/master/src/fbconsole.py',
@Zorono
Zorono / README.md
Created February 2, 2022 12:53 — forked from renestalder/README.md
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@Zorono
Zorono / Public_Time_Servers.md
Created March 3, 2022 02:11 — forked from mutin-sa/Top_Public_Time_Servers.md
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

Recovering deleted files in Ubuntu with ext4 filesystem

Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. These notes document the steps I took to get them back.

Important

  • this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir). The procedure needs that the partition that contained the files is unmounted, so if the deleted files were in the root partition, the process would be a bit different (e.g. storing the fs journal in a USB stick, using a live CD/USB to boot and issue the commands, etc.)
  • if something is not clear, you need more information, etc. check the sources below

With that out the way, let's begin.