This file contains hidden or 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
import csv | |
""" | |
Download the data here: https://github.com/angeloped/OSDSint/tree/master/geocodes | |
""" | |
with open("geocities.csv", 'r') as csv_file: | |
csv_globe = [a for a in csv.DictReader(csv_file)] | |
def pos_neg(num1, num2): |
This file contains hidden or 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
''' | |
620031587 | |
Net-Centric Computing Assignment | |
Part A - RSA Encryption | |
''' | |
import random | |
''' |
This file contains hidden or 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
def translit_farsi(word): | |
word = word.replace("ا", "a") | |
word = word.replace("أ", "a") | |
word = word.replace("آ", "a") | |
word = word.replace("إ", "e") | |
word = word.replace("ب", "b") | |
word = word.replace("ت", "t") | |
word = word.replace("ث", "th") | |
word = word.replace("ج", "j") | |
word = word.replace("ح", "h") |
This file contains hidden or 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
<?php | |
/* | |
A simple note composer web app written in PHP for lazy writers. | |
*/ | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Methods: GET, POST'); | |
header("Access-Control-Allow-Headers: X-Requested-With"); | |
if(!isset($_GET["save"])){ |
This file contains hidden or 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
#!/usr/bin/python | |
import sys | |
import time | |
try: | |
import urllib | |
except ImportError: |
This file contains hidden or 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
def near_square(n): | |
for i in range(n,0,-1): | |
if (i**(1.0/2))%1==0: # if perfect square | |
break | |
return i | |
print(near_square(26)) | |
print(near_square(10)) | |
print(near_square(9)) |
This file contains hidden or 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
def is_square(n): | |
return (n**(1.0/2))%1==0 | |
print(is_square(25)) | |
print(is_square(24)) | |
print(is_square(8)) | |
print(is_square(2)) | |
print(is_square(1)) |
This file contains hidden or 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
def near_cube(num): | |
for i in range(num,0,-1): | |
if (i**(1.0/3))%1==0: # if perfect cube | |
break | |
return i | |
print(near_cube(730)) | |
print(near_cube(729)) | |
print(near_cube(29)) |
This file contains hidden or 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
def is_cube(n): | |
return (n**(1.0/3))%1==0 | |
print(is_cube(28)) | |
print(is_cube(27)) | |
print(is_cube(10)) | |
print(is_cube(8)) | |
print(is_cube(3)) |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
text = "a♥O◘♦♥O◘♦" | |
try: | |
try: | |
stat = text.decode('ascii') | |
except UnicodeDecodeError: | |
stat = False |