Skip to content

Instantly share code, notes, and snippets.

View abdulmuneer's full-sized avatar

Abdul Muneer abdulmuneer

  • Intel Corporation
  • Bangalore
View GitHub Profile
@abdulmuneer
abdulmuneer / copy-of-pytorch_type_issue.ipynb
Created July 2, 2019 09:43
Copy of pytorch_type_issue.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- 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.
<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
@abdulmuneer
abdulmuneer / python_intro.py
Last active August 29, 2015 14:04
function to find the number of occurrences of '2' in first 'n' numbers.
#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:
@abdulmuneer
abdulmuneer / video_names.py
Last active December 11, 2015 18:39
Name mapping for the unnamed pyconindia 2012 videos in youtube
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
@abdulmuneer
abdulmuneer / tree_weight.py
Created October 10, 2012 19:02
Program to findout the maximum weight of the tree
'''
@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()]
@abdulmuneer
abdulmuneer / strange_print.py
Created October 12, 2011 08:30
Printing n numbers without using condition/loop/range
#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: