This file contains 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 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 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 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 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 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 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 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 |
This file contains 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
<h1>Privacy Policy</h1> | |
<p>Effective date: January 1, 2019</p> | |
<p>Xiaomi Firmware Updater ("us", "we", or "our") operates the https://Xiaomifirmwareupdater.github.io website (hereinafter referred to as the "Service").</p> | |
<p>This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data.</p> | |
<p>We use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, the terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, accessible from https://Xiaomifirmwareupdater.github.io</p> | |
<h2>Information Collection And Use</h2> | |
<p>We collect several different types of information for various purposes to provide and improve our Service to you.</p> | |
<h3>Types of Data Collected</h3> | |
<h4>Personal Data</h4> | |
<p>While using our Servic |
This file contains 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
curl -s https://api.github.com/orgs/$1/repos | egrep '"name"' | cut -d '"' -f4 > repos | |
cat repos | while read repo; do | |
curl -s https://api.github.com/repos/$1/$repo/releases | egrep 'download_count' | cut '-d:' -f 2 | sed 's/,/+/' | xargs echo | xargs -I N echo N 0 | bc >> counts | |
done | |
cat counts | while read repo; do | |
perl -nle '$sum += $_ } END { print $sum' | |
done | |
rm repos counts 2> /dev/null |