Skip to content

Instantly share code, notes, and snippets.

@tana9
tana9 / XPSPrinterChangePaperSize.cs
Last active March 27, 2022 05:37
Microsoft XPS Printer Writerの用紙サイズを変更
var printServer = new LocalPrintServer();
var printQueue = new PrintQueue(printServer, "Microsoft XPS Document Writer");
var printCap = printQueue.GetPrintCapabilities();
var pageMediaSize =
printCap.PageMediaSizeCapability.Single(s => s.PageMediaSizeName == PageMediaSizeName.ISOA4);
var printTicket = new PrintTicket
{
PageMediaSize = pageMediaSize
};
"""
Google MapsのdirectionsAPIの結果をJSON形式で保存する
"""
import json
import googlemaps
gmaps = googlemaps.Client(key="")
result = googlemaps.client.directions(gmaps, language="ja", mode="driving", origin="東京駅", destination="秋葉原駅")
print(result)
import codecs
import pandas as pd
import numpy as np
# Shift-JISを読み込み
with codecs.open("sample.csv","r", encoding="sjis",errors="ignore") as f:
df = pd.read_csv(f)
# 列を日付型に変換
def main():
addresses = [
"北海道札幌市中央区大通西28−2−5",
"北海道札幌市中央区南13条西13−2−10",
"北海道札幌市中央区南10条西9−1−48",
"北海道札幌市中央区南18条西8−1−43",
"北海道札幌市中央区双子山2−3−12",
"北海道札幌市中央区北14条西15−3−13",
"北海道札幌市中央区南29条西10−2−5",
"北海道札幌市中央区旭ケ丘1−11−20",