Skip to content

Instantly share code, notes, and snippets.

View iamtalhaasghar's full-sized avatar
🇵🇰
Working From Home

Talha Asghar iamtalhaasghar

🇵🇰
Working From Home
View GitHub Profile
@iamtalhaasghar
iamtalhaasghar / withdraw_calculations.py
Created January 13, 2021 10:02
A simple program to calculate actual withdraw amount of payoneer after deduction of 2% charges from USD to YOUR_NATIVE_CURRENCY
# A simple program to calculate actual withdraw amount of payoneer
payoneerCut = 2
rate = int(input('Enter currency rate of USD -> YOUR_NATIVE_CURRENCY : '))
amount = int(input('Enter amount to withdraw (in YOUR_NATIVE_CURRENCY): '))
rate = (rate - ((payoneerCut / 100) * (rate)))
print('New Rate of USD -> YOUR_NATIVE_CURRENCY : %.2f' % (rate))
print("You`ll recieve: %.2f (in YOUR_NATIVE_CURRENCY)" % (rate * amount))
@iamtalhaasghar
iamtalhaasghar / zipper.py
Created January 13, 2021 09:58
A python module which creates .zip & .rar archives of subfolders of a given path
# A python module which creates .zip & .rar archives of subfolders of a given path
def subFolders(folder_path):
'Returns list of subfolders of given path'
import os
foldersList = list()
print('Looking for subfolder of : %s' % (folder_path))
for i in os.listdir(folder_path):
if(os.path.isdir(i)):
print('%s' % (i), end=', ')
@iamtalhaasghar
iamtalhaasghar / renamer.py
Last active January 13, 2021 09:58
A simple script to prettify pdf file names
# A simple script to prettify pdf file names
def listAllPdfFiles(dirPath):
'Return list of all pdf files of provided path'
import os
pdfFiles = list()
print('Looking for pdf files...')
for f in os.listdir():
if(os.path.isfile(f) and f.endswith('.pdf')):
print('%s' % f, end=", ")
@iamtalhaasghar
iamtalhaasghar / email_scraper_from_google_forms_analytics_page.js
Last active December 9, 2020 11:03
A simple javascript code snippet to scrap emails from a Google Forms Page (View other Responses Page). Just open up the Google Form in a new tab. Go to Console, paste the code and boom!!! ProTip: Copy the console log to clipboard and then paste the clipboard contents to a newly created .txt file. You will have your required data in a nice format.
/*
It only scraps first 100 emails because other emails are not visible.
Whenever I will have time, i will try to work around this problem
Tested on Firefox 80.0.1
Not sure about other browsers, (theoretically it should work)
*/
// xpath of div containing emails in a google form
allDivs = $x("//*[contains(text(),'Email') and @class='freebirdAnalyticsViewQuestionTitle']/ancestor::div[@class='freebirdAnalyticsViewAnalyticsHover']")
// get innerText which is essentially emails of all correspondents and also contains some other irrelevant text
uglyData = allDivs[0].innerText.split('\n')
@iamtalhaasghar
iamtalhaasghar / youtube_videos_title_scraper_from_a_playlist.js
Last active December 9, 2020 10:51
A simple javascript code snippet to scrap video list from a youtube playlist. Just open up the playlist in a new tab. Go to Console, paste the code and boom!!! ProTip: Copy the console log to clipboard and then paste the clipboard contents to a newly created .csv file. You will have your required data in a nice clean format.
/*
I use this script to scrap video titles of a playlist of my competitor and
then I use those keywords in my playlist videos too.
Tested on Firefox 80.0.1
Not sure about other browsers
*/
// get div containing playlist items
playlist = document.getElementsByTagName('ytd-playlist-video-renderer')