Skip to content

Instantly share code, notes, and snippets.

View stevedep's full-sized avatar

Steve de Peijper stevedep

View GitHub Profile
import img2pdf
from PIL import Image
from io import BytesIO
def convert_png_to_pdf_multiple_pages(png_path, output_pdf_path, num_pages):
"""Converts a PNG image (of SVG) to a PDF with multiple A4 pages in landscape.
Args:
png_path (str): Path to the PNG image file.
output_pdf_path (str): Path to save the generated PDF file.
async function getTransactions(i) {
let response = await // fetch here
let data = await response.json();
return data;
}
function process(r, i, a) {
console.log(i)
result.push(r[0].data.recipeSearch.result)
if (i == a){ //* 1 + 7))) {
from datetime import datetime
import csv
pad = "/home/steve/Documents/Transacties/CSV_CC_6606_20230401_20230718.csv"
with open(pad, 'r') as csv_file:
csv_reader = csv.reader(csv_file)
transactions = list(csv_reader)
Sub MergeDocumentsWithHeadings()
Dim objDoc As Document
Dim objRange As Range
Dim strFolder As String
Dim strFileName As String
Dim strHeader As String
Dim dtCreated As Date
Dim headingLevel As Integer
Dim chapters() As Variant
Dim chapter As Variant
<html>
<head>
<title>Organizational Chart</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="scripts/jquery-3.2.1.min.js"></script>
<script src="scripts/d3.v3.min.js"></script>
<style>
.node circle {
fill: #fff;
stroke: steelblue;
Sub openmail()
Set oOutlook = GetObject(, "Outlook.Application")
Set NS = oOutlook.GetNamespace("MAPI")
NS.Logon
Set msg = NS.GetItemFromID(ActiveCell.Value)
msg.display
Set objInsp = msg.GetInspector
Set objDoc = objInsp.WordEditor
Application.Wait (Now + TimeValue("0:00:02"))
import sys
sys.path.append('/home/odroid/Documents/WhatsApp')
import wy #please note you need to specify the path above, or import from a folder that is known.
#you need this one with crontab else you get error, process closed unexpectedly
from pyvirtualdisplay import Display
display = Display(visible=0, size=(2880, 1800)).start()
message = (sys.argv[1])
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
from datetime import datetime
def send_message(msg, t="s", group="testing"):
let
Source = List.Generate(() => 1, each _ <= NumberOfPages, each _ + 1),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Page"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Data", each fnCarData([Page])),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"id", "title", "price", "year", "fuel", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "ModelInfo", "CatalogPrice"}, {"id", "title", "price", "year", "fuel", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "ModelInfo", "CatalogPrice"}),
#"Added Custom1" = Table.AddColumn(#"Expanded Data", "age", ea
(p) => let
Source = Web.BrowserContents(Url & "&page=" & p, [WaitFor = [Timeout = #duration(0,0,0,10)]]),
JsonDocument = Json.Document( Text.Split( Text.Split( Source, "<script id=""__NEXT_DATA__"" type=""application/json"">"){1}, "</script>"){0}),
props = JsonDocument[props],
pageProps = props[pageProps],
initialState = pageProps[initialState],
searchReducer = initialState[searchReducer],
occasions = searchReducer[occasions],
#"Converted to Table" = Table.FromList(occasions, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "title", "model", "modelId", "brand", "brandId", "price", "img", "year", "bodyType", "fuel", "isImported", "provider", "licensePlate", "km", "description", "nameEntry", "place", "province", "endAuction", "dealerInfo", "popup", "portalListDescription", "portals", "schemaOrg"}, {"id", "title", "model", "modelId", "brand", "brandId", "price", "img", "year", "