- plugin Map for VS Code をいれる
- Cmd + , で呼び出すセッティングから、プラグインの設定。 Enable HTML とThemes beamer.css などを加える。
2024年2月11日日曜日
marp をvs code で使う
marpはmarkdownでスライドを作るツール。
2023年12月11日月曜日
mac のコマンドラインでpdfからsvgへ変換
調べると、inkscape を使う方法や、imagemagick のconvert を使う方法が出てくるのだが、今ひとつうまくいかない。popplerのpdftocairoを使ったらうまくいった。
> pdftocairo -svg file.pdf file.svgなぜcairoなのかよくわからない。。 ちなみに、ディレクトリにあるpdfを一括で変換するには
> foreach f in *.pdf ; do pdftocairo -svg $f $f:r.svg ; doneとすればいい。
2023年11月14日火曜日
docker のコンテナからホストのssh-agentを使う
docker を開発環境として使う場合、内部からsshにアクセスしたくなるが .ssh をbindマウントしたり、コピーしたりするのも面倒。
どうするのが正解なのかと思っていたら普通にホストのssh-agentを使う機能が用意されていた。すごいな。
version: '3' services: ubuntu: build: context: . dockerfile: Dockerfile container_name: ubuntu-test stdin_open: true # docker run -i tty: true # docker run -t platform: linux/amd64 entrypoint: bin/bash volumes: - "/run/host-services/ssh-auth.sock:/tmp/ssh-agent.sock" environment: SSH_AUTH_SOCK: "/tmp/ssh-agent.sock"最後のvolumeとenvironment がポイント。これはmacでのやり方なので、 linuxだとまた違うようだ。
2023年4月19日水曜日
seleniumでasciidocファイルをPDFに変換
これには
- selenium に asciidoctor extension を入れる
- PDFを指定して印刷する
Selenium に extensionを入れる
これには、- extensionのcrxファイルを入手する
- crxファイルを指定してドライバをつくる
crxファイルの入手
crxファイルを入手する方法は このブログ に書かれている。ダウンロードをやってくれるサイトがあるらしいのだが、ドメインが切れたらしく 怪しいことになっていたので、再パッケージする方法を使う。 基本的には、chromeのextension のページで、pack extension ボタンで、導入されているextensionのパスを指定すれば いいのだが、そのパスがわからない。そんなときは、 chrome://version のProfilePathを見ればわかる。この下のExtensions以下にIDのディレクトリがある。 ディレクトリ名はIDだが、個々のExtensionのIDはchromeのextensionsのページ chrome://extensions/ を見ればわかる。 manifest.jsonにも アプリ名が入っているはずなのだが、メッセージファイルを参照している場合もあるようで、grepしてもわからない。ドライバをつくる
from selenium import webdriver from selenium.webdriver.chrome.options import Options options=Options() options.add_extension(pathToExtension) driver = webdriver.Chrome("./chromedriver", options=options)
PDFを指定して印刷
こちらのサイトに書いてある。 しかしこれどうやって調べたんだろう。どこに書いてあるのかなあ。。注意点としては、savefile.default_directory の指定はどうも絶対パスでないといけないようなので、 Pathを使って作ってやる必要がある。
pathToExtension="2.7.0_0.crx" def optionsSetUp(): #印刷としてPDF保存する設定 options=Options() appState = { "recentDestinations": [ { "id": "Save as PDF", "origin": "local", "account":"" } ], "selectedDestinationId": "Save as PDF", "version": 2, "isLandscapeEnabled": False, #印刷の向きを指定 tureで横向き、falseで縦向き。 "pageSize": 'A4', #用紙タイプ(A3、A4、A5、Legal、 Letter、Tabloidなど) "isHeaderFooterEnabled": False, #ヘッダーとフッター "isCssBackgroundEnabled": True, #背景のグラフィック "isCollateEnabled": True #部単位で印刷 } prefs = {'printing.print_preview_sticky_settings.appState': json.dumps(appState), "savefile.default_directory": str(Path('../rendered').resolve()) } #appState --> pref options.add_experimental_option('prefs', prefs) options.add_argument('--kiosk-printing') options.add_extension(pathToExtension) return options driver = webdriver.Chrome("./chromedriver", options=options) driver.get(URL) time.sleep(2) # ページが確実にレンダリングされるのを待つ driver.execute_script('window.print();')
2023年2月11日土曜日
chrome extention vimium
chrome をキーボード操作したい、という欲求が定期的に出てくる。いろいろ試して、だいたいなんか予想外の挙動が起きてはずしているのだけど、今度はvimiumというものを試してみる。ちょっと試した感じではGmailではキーイベントを取られてしまって動かないっぽい。
こちら にある。
チートシート を転載しておこう。なんかありすぎて わからないが、とりあえずFでリンクが出るのと、
HL でヒストリ移動、JKでタブ移動だけでも、便利。エスケープでモードから抜ける。
? show the help dialog for a list of all available keys h scroll left j scroll down k scroll up l scroll right gg scroll to top of the page G scroll to bottom of the page d scroll down half a page u scroll up half a page f open a link in the current tab F open a link in a new tab r reload gs view source i enter insert mode -- all commands will be ignored until you hit Esc to exit yy copy the current url to the clipboard yf copy a link url to the clipboard gf cycle forward to the next frame gF focus the main/top frame newpage o Open URL, bookmark, or history entry O Open URL, bookmark, history entry in a new tab b Open bookmark B Open bookmark in a new tab find系 / enter find mode -- type your search query and hit enter to search, or Esc to cancel n cycle forward to the next find match N cycle backward to the previous find match history H go back in history L go forward in history tab J, gT go one tab left K, gt go one tab right g0 go to the first tab. Use ng0 to go to n-th tab g$ go to the last tab ^ visit the previously-visited tab t create tab yt duplicate current tab x close current tab X restore closed tab (i.e. unwind the 'x' command) T search through your open tabs W move current tab to new windowpin/unpin current tab
2023年1月28日土曜日
visual studio の単語区切り
visual studio には単語単位のforward backward 等があるが、
日本語の編集中にはあんまりうまく機能しない。
藤井大洋先生が、形態素解析を行うランゲージサーバでいれてなにかされている
ようだがそれは後で試すとして、とりあえず、単語区切りに「を」とか「が」とか「、」「。」あたりを入れるとちょっとましになる。ちょっとだけど。
こちら を参考に。
登録:
投稿 (Atom)