Skip to content

Instantly share code, notes, and snippets.

View mos3abof's full-sized avatar

Mosab Ibrahim mos3abof

View GitHub Profile
@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>
@mos3abof
mos3abof / restart_apache_fabfile.py
Last active January 31, 2019 14:43
Poor Man's Guide for Monitoring a Website Using Python on Ubuntu and Restarting Apache when it is down. http://www.mos3abof.com/poor-man-website-python-monitor.html
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Import DateTime
from datetime import datetime, timedelta, date
# Import urllib
import urllib
# Importing utilities from Fabric
@mos3abof
mos3abof / most_shared_youtube_vids_egypt.py
Created November 28, 2012 21:24
This script parses the most shared videos on Youtube using standard video feed for the region Egypt (EG) and emails basic information about them to a predefined list of recipients using Gmail.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Important imports
import os, sys
# Append the python libs installed on dreamhost to the sys.path
sys.path.append(os.environ['HOME'] +'/lib/python')
# Import email stuff