Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
SUFFIXES = { | |
1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'] | |
} | |
def approximate_size(size, a_kilobyte_is_1024_bytes=True): | |
'''Convert a file size to human-readable form. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName www.example.com | |
ServerAlias example.com | |
ServerAdmin webmaster@example.com | |
DocumentRoot /usr/local/www/documents | |
Alias /robots.txt /usr/local/www/documents/robots.txt | |
Alias /favicon.ico /usr/local/www/documents/favicon.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#one easy solution: | |
def get_digit_count(n): | |
count = 0 | |
for numbers in range(n): | |
count = count + str(numbers).count('2') | |
return count | |
# in the above program: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapping = { | |
'00062' : 'Build your own IVR.', # No Audio til 1:55. | |
'00063' : 'Build your own IVR.', | |
'00067' : 'Build your own IVR.', | |
'00068' : 'Build your own IVR.', | |
'00070' : 'Build your own IVR.', | |
'00072' : 'Build your own IVR.', | |
'00073' : 'Build your own IVR.', | |
'00074' : '???', # unable to make out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@author: A_Muneer | |
''' | |
import sys | |
#file_name = 'tri.txt' | |
def get_tree(file_name): | |
with open(file_name) as myfile: | |
return [line.strip().split() for line in myfile if line.strip()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Printing n numbers without using condition/loop/range | |
#dangerous to use :) Involves modifying sys variables that can crash \ | |
#other python programs sharing the same interpreter | |
import sys | |
def strange_print(n): | |
print n | |
n+=1 | |
try: |