Skip to content

Instantly share code, notes, and snippets.

View 136s's full-sized avatar

136s

View GitHub Profile
@136s
136s / MakeFilters.vb
Last active March 14, 2024 06:04
add filters to all sheets in a Excel book
Sub MakeFilter()
' ウィンドウ枠の固定
If ActiveWindow.FreezePanes = True Then
ActiveWindow.FreezePanes = False
End If
If Selection(1) = Range("A1") Then
Range("B2").Select
End If
@136s
136s / pdf_link_converter.py
Created February 13, 2024 09:25
Convert file links in pdf from absolute paths to relative paths.
@136s
136s / remove_localhost_from_pdf.py
Created September 8, 2023 07:33
Remove 'http://localhost' from all links in a PDF file.
#!/usr/bin/env python
import re
import sys
import fitz
def remove_localhost_from_pdf(
pdf_filename: str, pattern: re.Pattern = re.compile(r"^http://localhost:\d+/")
):
@136s
136s / mwe_selenium_wikipathways.py
Created June 14, 2023 09:05
A minimal working example to reproduce the margins when pdfing WikiPathways pathway maps using selenium.
import base64
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.print_page_options import PrintOptions
url = "https://example.com/"
url = "https://pathway-viewer.toolforge.org/embed/WP1"
window_width, window_height = 800, 600
@136s
136s / concat_svg.bat
Last active August 17, 2023 02:06
同じフォルダにあるすべての svg を結合して 1 つの PDF ファイルにする
@echo off
echo 同じフォルダにあるすべての svg を結合して 1 つの pdf ファイルにします
if exist "*.pdf" (
echo PDF が存在します。処理を中止します。
pause
exit /b
)
set /p output=出力ファイル名を入力してください(拡張子不要、初期値: output):
@136s
136s / emoji2icon.bat
Last active September 12, 2023 01:04
Twemoji から SVG を DL して余白付きアイコンにするスクリプト
@echo off
curl https://raw.githubusercontent.com/twitter/twemoji/master/assets/svg/%1.svg > %1.svg
magick -density 1024 -gravity center -background white %1.svg -extent 512x512 %1.png
@136s
136s / quiz_hideseek.py
Created October 9, 2022 06:14
クイズかくれんぼの子・鬼の得点を全探索で計算する(本家: youtu.be/wvw27-wA3Lc )
from itertools import product
from typing import Tuple
def get_total_points(a:int, c:int, d:int, p:float, q:float) -> Tuple[float]:
"""
クイズかくれんぼの子・鬼の合計得点を全探索で取得する。
Parameters
----------
a : int