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
BlockingCollection<Page> _jobs = new BlockingCollection<Page>(); | |
var tasks = new ConsumerStarter().StartAsyncConsumers(_threadCount, _cancellationToken, DownloadPage); | |
for (var i = 0; i < _pageCount; i++) | |
{ | |
_jobs.Add(new Page { PageId = pageIds[i], PageNumber = Path.GetFileNameWithoutExtension(pages[i]), FileName = pages[i] }); | |
} | |
_jobs.CompleteAdding(); | |
Task.WaitAll(tasks.ToArray(), _cancellationToken); |
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
PageSize documentSize; | |
using (var firstImage = new Bitmap(firstPagePath)) | |
{ | |
documentSize = new PageSize(firstImage.Width, firstImage.Height); | |
} | |
using (var pdf = new PdfDocument(new PdfWriter(pdfPath))) | |
{ | |
using (var writer = pdf.GetWriter()) | |
{ |
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
public static async Task<string> GetTextBody(string url) | |
{ | |
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); | |
myRequest.Method = "GET"; | |
WebResponse myResponse = await myRequest.GetResponseAsync(); | |
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8); | |
string result = await sr.ReadToEndAsync(); | |
sr.Close(); | |
myResponse.Close(); |
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
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"profiles": | |
[ | |
{ |
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
# Rekhta Import | |
# Please make sure that you are not using scaling on your windows computer before running this script | |
# Running this script will cause partial images to be recorded | |
# Requires the selenium web driver. Check this link https://selenium-python.readthedocs.io/installation.html | |
# This script uses firefox. Please make sure you have firefox installed on your computer. | |
#pip install selenium | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys |
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
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands | |
# cat paths | |
/_cat/allocation | |
/_cat/shards | |
/_cat/shards/{index} | |
/_cat/master | |
/_cat/nodes | |
/_cat/indices | |
/_cat/indices/{index} |