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 pandas as pd | |
| import bs4, requests | |
| wiki_link = 'https://en.wikipedia.org/wiki/List_of_chess_grandmasters' | |
| # link to wiki page | |
| soup = bs4.BeautifulSoup(requests.get(wiki_link).text, 'html.parser') | |
| # build the soup :P | |
| table = pd.io.html.read_html(str(soup.find('table', id='grandmasters'))) |
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 apply_padding(string, paddingLen, padding='.'): | |
| if len(string) %2 != paddingLen % 2: | |
| string = padding + string | |
| if len(string) >= paddingLen: | |
| return string | |
| else: | |
| return apply_padding(string=padding+string+padding, paddingLen=paddingLen) | |
| inpList = ['apple', 'banana', 'orange', 'choco'] |
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 urllib.request | |
| a = urllib.request.urlopen(url) | |
| eval(a.read()) | |
| # https://stackoverflow.com/a/47341399/4417821 - Xantium, StackOverflow | |
| # ensure that depending url does't import any that may not exist on a system. use this only for simple scripts. |
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
| # pip install merge-pdf | |
| from merge_pdf import merge | |
| import glob | |
| output_file, outFolder, folder, folderFiles = 'merged_files.pdf', '.', '.', '.' | |
| files_list=glob.glob(folder+'/*.pdf') | |
| merge.Merge (output_file, debug= True).merge_file_list (files_list) |
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 img2pdf, glob, os | |
| from tqdm import tqdm | |
| def main(): | |
| os.makedirs(name='imgs_as_pdfs', exist_ok=True) | |
| for img in tqdm(glob.glob('./*.png')): | |
| with open(img, 'rb') as f: | |
| pdf = img2pdf.convert(f) | |
| with open(f'imgs_as_pdfs/{img[:-4]}.pdf', 'wb') as f: | |
| f.write(pdf) |
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
| <! –– | |
| usage: | |
| host resume_pdf.htm on website | |
| eg : magnus167.github.io/resume_pdf.htm | |
| get raw link to md file | |
| magnus167.github.io/resumeCV/resume_pdf.htm?src=https://raw.githubusercontent.com/Magnus167/resumeCV/master/resume.md | |
-
View PDFs hosted on github using google drive viewer. https://webapps.stackexchange.com/questions/48061/can-i-trick-github-into-displaying-the-pdf-in-the-browser-instead-of-downloading
-
Adding a dark mode toggle to jekyll theme Github pages https://web.archive.org/web/20220520014459/https://medium.com/@derekkedziora/how-to-add-a-dark-mode-toggle-to-a-jekyll-site-a76dac00128d
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy as np | |
| import PIL.Image as Image | |
| import pdf2image | |
| import sys, os, glob | |
| from tqdm import tqdm | |
| def get_files(path, ext='pdf'): | |
| rChar = '/' if sys.platform == 'posix' else '\\' | |
| return [f.split(rChar)[-1] for f in glob.glob(path + '/*.' + ext.lower())] |