From 393e6cd7ddc1f1c182b3e9d0d57831e4a71c757e Mon Sep 17 00:00:00 2001 From: Jason A Smith Date: Sat, 11 Jul 2015 11:00:09 -0700 Subject: [PATCH 1/7] Add user_posts permission to README Without the user_posts permission all results from the streams table will be empty. --- Facebook/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Facebook/README.md b/Facebook/README.md index 2c77a9f..f9fd548 100644 --- a/Facebook/README.md +++ b/Facebook/README.md @@ -9,6 +9,7 @@ Automate replies to all birthday wishes on your facebook wall. * Get a valid Access Token from [Facebook Graph API explorer](https://developers.facebook.com/tools/explorer/) and grant the following permissions: * `read_insights` * `publish_actions` + * `user_posts` * Change the timestamp to your birthday From 9493d2613f32474ec683ae3f1467268051e6fc16 Mon Sep 17 00:00:00 2001 From: iCHAIT Date: Mon, 20 Jul 2015 18:45:33 +0530 Subject: [PATCH 2/7] Minor change --- The Sorting Hat/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/The Sorting Hat/README.md b/The Sorting Hat/README.md index b1aecf1..8e641fd 100644 --- a/The Sorting Hat/README.md +++ b/The Sorting Hat/README.md @@ -26,4 +26,4 @@ TODO * Make a **GUI** using **pyQT**. -* Test the script on other linux OS. +* Test the script on other Opertaing Sytems. From 85c08cfff85ca9854db1d8ff49b0aab1c11389f9 Mon Sep 17 00:00:00 2001 From: iCHAIT Date: Sun, 13 Sep 2015 00:55:26 +0530 Subject: [PATCH 3/7] renamed repo for detaching sub folder --- {The Sorting Hat => Sorting-Hat}/README.md | 0 {The Sorting Hat => Sorting-Hat}/sorting-hat.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {The Sorting Hat => Sorting-Hat}/README.md (100%) rename {The Sorting Hat => Sorting-Hat}/sorting-hat.py (100%) diff --git a/The Sorting Hat/README.md b/Sorting-Hat/README.md similarity index 100% rename from The Sorting Hat/README.md rename to Sorting-Hat/README.md diff --git a/The Sorting Hat/sorting-hat.py b/Sorting-Hat/sorting-hat.py similarity index 100% rename from The Sorting Hat/sorting-hat.py rename to Sorting-Hat/sorting-hat.py From be379ec02c4b2fccefbc8c98261cb2ca0cfa4ca2 Mon Sep 17 00:00:00 2001 From: iCHAIT Date: Sun, 13 Sep 2015 01:08:34 +0530 Subject: [PATCH 4/7] sorting-hat detached --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index c4d8112..63eb957 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Here are some scripts that I have written in python. Most of these scripts were * [FBWishReplier](#FBWish) * [OS X Mirror](#mirror) -* [The Sorting Hat](#hat) * [agecalulator](#calculator) * [googleSearch.py](#google) * [location.py](#location) @@ -27,11 +26,6 @@ https://github.com/iCHAIT/Python-Scripts/tree/master/Facebook A python script to create the Mirror of the hard disk for the OS X operating system. The script creates a 0 byte directory structure for the entire hard disk. -## The Sorting Hat - -A python script to sort any directory on your linux system on the basis of its type i.e all your music moves to a sub directory MP3, all your pdf files move to a folder PDF and so on. - - ## agecalulator These scripts will calculate your age and the number of days you've lived till now!! From 645d640c9e93a7d0de8af14e93e17d862d10cf50 Mon Sep 17 00:00:00 2001 From: iCHAIT Date: Sun, 13 Sep 2015 01:11:32 +0530 Subject: [PATCH 5/7] removed sorting-hat --- Sorting-Hat/README.md | 29 ------------------------ Sorting-Hat/sorting-hat.py | 45 -------------------------------------- 2 files changed, 74 deletions(-) delete mode 100644 Sorting-Hat/README.md delete mode 100644 Sorting-Hat/sorting-hat.py diff --git a/Sorting-Hat/README.md b/Sorting-Hat/README.md deleted file mode 100644 index 8e641fd..0000000 --- a/Sorting-Hat/README.md +++ /dev/null @@ -1,29 +0,0 @@ -The Sorting Hat -=========== - -A python script to sort any directory on your linux system on the basis of its type i.e all your music moves to a sub directory MP3, all your pdf files move to a folder PDF and so on. - - - -### Why? - -The Downloads folder on my Mac became very disorganized with time, having hundreds of file in no order whatsoever made it very difficult to search for anything. - - - -#### Shout-outs - - -* [@dufferzafar](http://github.com/dufferzafar/) for https://github.com/dufferzafar/Autohotkey-Scripts/tree/master/The%20Sorting%20Hat - -* [@akifkhan](https://github.com/akifkhan) for https://github.com/akifkhan/Sorting-Hat - - - -TODO -==== - -* Find an elegant way to solve the conflict if the file to be sorted (say README.md ) is already present in the corresponding subdirectory ( MD ). - -* Make a **GUI** using **pyQT**. - -* Test the script on other Opertaing Sytems. diff --git a/Sorting-Hat/sorting-hat.py b/Sorting-Hat/sorting-hat.py deleted file mode 100644 index ace8e20..0000000 --- a/Sorting-Hat/sorting-hat.py +++ /dev/null @@ -1,45 +0,0 @@ -import os -import shutil - -user = os.getenv("USER") -# direc = "/Users/"+user+"/Downloads/" -direc = "/Users/"+user+"/Desktop/hat/" - - -def findExtension(files): - # Find the extension of the file - extn = os.path.splitext(files)[1].replace('.', '') - dirname = extn.upper() - return dirname - - -def FileExist(direc, dirname, files): - # Check if the file to be sorted already exist in the target subdirectory. - # if it doesn't then move it. - if os.path.isfile(os.path.join(direc, dirname, files)): - print "Could not move "+os.path.join(direc, files)+" it already exist in "+os.path.join(direc, dirname) - return - shutil.move(os.path.join(direc, files), os.path.join(direc, dirname)) - - -def makeTheDir(files): - # Make the target sub directory. - os.mkdir(os.path.join(direc, dirname)) - shutil.move(os.path.join(direc, files), os.path.join(direc, dirname)) - - -try: - os.chdir(direc) - for files in os.listdir(direc): - if not files.startswith('.'): # Ignoring hidden files - if os.path.isfile(files): - dirname = findExtension(files) - if os.path.isdir(os.path.join(direc, dirname)): - FileExist(direc, dirname, files) - - else: - makeTheDir(files) - print "All Done!" - -except IOError: - print "Error in reading file" From 1dbda635a8d19d1a09e49e80b036dd163e5ab884 Mon Sep 17 00:00:00 2001 From: Chaitanya Gupta Date: Sun, 8 May 2016 19:12:38 +0530 Subject: [PATCH 6/7] Todo for makefile added --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63eb957..061989f 100644 --- a/README.md +++ b/README.md @@ -68,5 +68,6 @@ ISSUES TODO ==== +* Add Makefile * Script to wish birthday on friend's wall on facebook. -* Script for scraping GitHub news feed and mail the data to the user. \ No newline at end of file +* Script for scraping GitHub news feed and mail the data to the user. From 97d6c92851590c110ea23f873be68ea8534a17e4 Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Fri, 28 Oct 2022 00:39:22 +0530 Subject: [PATCH 7/7] python3 compatible --- agecalulator/agecalculator1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agecalulator/agecalculator1.py b/agecalulator/agecalculator1.py index d242631..9cf825e 100644 --- a/agecalulator/agecalculator1.py +++ b/agecalulator/agecalculator1.py @@ -7,8 +7,8 @@ now = date.today() age = now - birthday - print "You are %d years old " % (age.days / 365) - print "You've lived %d days" % (age.days) + print(f"You are {age.days / 365} years old") + print(f"You've lived {age.days} days") -except ValueError, err: - print 'ERROR:', err +except ValueError as err: + print(f"ERROR: {err}")