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
// ==UserScript== | |
// @name Binaa Manhaji Download Questions as CSV | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Adds a download button to binaamanhaji quiz pages to get all questions as CSV file, so they can be imported to Anki. | |
// @author yshalsager | |
// @match *://*.binaamanhaji.com/usercontrol/excercise?lesson_id=* | |
// @match *://*.binaamanhaji.com/usercontrol/exam* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=binaamanhaji.com | |
// @grant none |
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
#!/bin/bash | |
# Scrapes mp3 files links from audio.islamweb.com links into csv data: url, filename | |
function islamweb_get_mp3() { | |
URL=$1 | |
PAGES="${2:-1}" | |
for page in $(seq 1 $PAGES); do | |
case $URL in | |
*pageno=*) | |
URL=$(echo $URL | sed "s|pageno=[0-9]\+|pageno=$page|g");; | |
*) |
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
# sed -r -e 's/\r$//;/^[0-9]+$/{N;/\n[0-9]/d;}' -> remove lines with timestamps | |
# sed -e '/^$/d' -> remove empty lines | |
# perl -p -e 's|(.*[^\.]$)\n|\1 |g' -> remove new line between paragragh lines. | |
# ${1%.*} -> input filename without extension | |
function srt2txt() { | |
cat $1 | sed -r -e 's/\r$//;/^[0-9]+$/{N;/\n[0-9]/d;}' | sed -e '/^$/d' | perl -p -e 's|(.*[^\.]$)\n|\1 |g' > "${1%.*}".txt | |
} |
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 python3 | |
from urllib.parse import urlparse | |
from requests import get | |
from bs4 import BeautifulSoup | |
from requests.api import head | |
def get_url_hostname(url): | |
parsed_uri = urlparse(url) | |
return f'{parsed_uri.scheme}://{parsed_uri.netloc}' |
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 python3 | |
from humanize import naturalsize | |
from requests import get | |
org = "" | |
org_size = [] | |
repo_count = 0 | |
response = get(f"https://api.github.com/orgs/{org}/repos") |
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
from requests import get | |
from bs4 import BeautifulSoup | |
site = "https://www.princeofwales.gov.uk" | |
url = f"{site}/biographies/hrh-prince-wales/speeches?title=&mrfs=All&date_from=&date_to=&page=" | |
for page in range(0, 77): # hardcoded page number | |
print(page) | |
speeches = BeautifulSoup(get(f"{url}{page}").content, "html.parser").select("div.views-row > div:nth-child(1) > h2:nth-child(1) > a:nth-child(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
#!/usr/bin/env python3 | |
from requests import get | |
from bs4 import BeautifulSoup | |
chapter = input("Enter Sura number\n") | |
url = f"http://corpus.quran.com/translation.jsp?chapter={chapter}" | |
page = BeautifulSoup(get(f'{url}&verse=1').content, "html.parser") | |
verses = int(page.select_one("#verseList > option:last-of-type")['value']) |
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 python3.7 | |
""" | |
A script that calcuate sum of github organization's repositories stargazers | |
""" | |
from requests import get | |
ORG = "XiaomiFirmwareUpdater" | |
START_PAGE = 1 | |
END_PAGE = 2 |
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
### Keybase proof | |
I hereby claim: | |
* I am yshalsager on github. | |
* I am yshalsager (https://keybase.io/yshalsager) on keybase. | |
* I have a public key ASBzAw86UrjzbEdWDjWwRPQI7yeao0X4oU-S11iVhWhrlAo | |
To claim this, I am signing this object: |
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
Verifying my Blockstack ID is secured with the address 12TKkXSM5XoGRNuqt21c9CvFMfQwRXFD9b https://explorer.blockstack.org/address/12TKkXSM5XoGRNuqt21c9CvFMfQwRXFD9b |