Skip to content

Instantly share code, notes, and snippets.

View mos3abof's full-sized avatar

Mosab Ibrahim mos3abof

View GitHub Profile
@mos3abof
mos3abof / pycharm.desktop
Created August 5, 2014 09:46
Pycharm Desktop Entry
[Desktop Entry]
Name=Pycharm 3.4.1
Comment=Python IDE
TryExec=/path/to/pycharm-community-3.4.1/bin/pycharm.sh
Exec=/path/to/pycharm-community-3.4.1/bin/pycharm.sh
Icon=/path/to/pycharm-community-3.4.1/bin/pycharm.png
Categories=Development;IDE;Python;
Terminal=false
Type=Application
StartupNotify=true
@mos3abof
mos3abof / tables_referencing_my_table.sql
Created August 4, 2014 13:19
List tables referencing 'my_table' in 'my_database' MySQL database
select
table_name
from
information_schema.KEY_COLUMN_USAGE
where
table_schema = 'my_database'
and referenced_table_name = 'my_table';
def ascii_to_binary(ascii_text):
binary_text = ''
for c in ascii_text:
binary_text += bin(ord(c))[2:].zfill(8)
return binary_text
def binary_to_ascii(binary_text):
return ''.join(chr(int(binary_text[i:i+8], 2)) for i in xrange(0, len(binary_text), 8))
@mos3abof
mos3abof / complete_cure_device.py
Last active August 29, 2015 14:01
Egyptian Army claimed they invented a cure for AIDS and Hepatites C, and promised to start healing people June the first! Here is a count down!
#!/usr/bin/python
# -*- coding: utf-8 -*-
#@author Mosab Ahmad <mosab.ahmad@gmail.com>
import datetime
delta = datetime.datetime(2014, 6, 1) - datetime.datetime.now()
days = delta.days
seconds = delta.seconds

Keybase proof

I hereby claim:

  • I am mos3abof on github.
  • I am mos3abof (https://keybase.io/mos3abof) on keybase.
  • I have a public key ASBlDut8UpMXWCqjKIconLKmTUGE628ZAKrdGkLDVRIftAo

To claim this, I am signing this object:

@mos3abof
mos3abof / democratic_permutations.py
Last active January 4, 2016 08:29
Calculating different permutations of the democratic path we got in Egypt.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Calculating different permutations of the democratic path we got in Egypt.
from itertools import permutations
i = ['دستور', 'برلمان', 'رئاسة']
results = []
for a in permutations(i, 3):
@mos3abof
mos3abof / pay_it_forward.py
Last active January 2, 2016 12:09
Plot the equation "y = 5 ** x" for the integer values between 1 and a million.
import math
from matplotlib import pyplot
figsize = (15, 5)
pyplot.figure(figsize=figsize)
pyplot.title('Paying it forward')
data = []
end = 1000000
@mos3abof
mos3abof / traceroute_easter_egg.py
Created April 7, 2013 02:22
Printing the Easter Egg in "traceroute 216.81.59.173" in a human readable way :)
#!/usr/bin/python
import subprocess
command = ['traceroute', '216.81.59.173']
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lines = []
while(True):
retcode = p.poll()
@mos3abof
mos3abof / tower_of_hanoi.py
Created March 24, 2013 14:24
Classic puzzle "Tower of Hanoi" recursive solution in python
def hanoi(n, fr, to, spare):
'''(int, str, str, str)
Solve the classic puzzle Tower of Hanoi
>>> hanoi(1, "Middle", "Left", "Right")
- Move top ring in 'Middle' tower to the 'Left' tower
'''
def print_move(fr, to):
print "- Move top ring in '{}' tower to the '{}' tower".format(fr, to)
@mos3abof
mos3abof / apache2_default_page
Created March 14, 2013 13:12
Apache2 Default Page
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>