Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
:outside_you:

Amane Katagiri amane-katagiri

🙃
:outside_you:
View GitHub Profile
@amane-katagiri
amane-katagiri / expose-wsl-server.ps1
Last active June 3, 2023 20:36
Expose server connection on WSL to LAN.
View expose-wsl-server.ps1
#!/usr/bin/pwsh
if ($args.count -eq 0){
$connectport = [Microsoft.VisualBasic.Interaction]::InputBox("Input connectport (expose port on wsl)", $MyInvocation.MyCommand.Name, "8000")
if ($connectport.length -eq 0) {
Write-Error "Set connectport" -ErrorAction Stop
}
$listenport = [Microsoft.VisualBasic.Interaction]::InputBox("Input listenport (expose port on host)", $MyInvocation.MyCommand.Name, $connectport)
if ($listenport.length -eq 0) {
Write-Error "Set listenport" -ErrorAction Stop
@amane-katagiri
amane-katagiri / sample.atom.xml
Last active June 4, 2023 01:26
Atomフィードのサンプル
View sample.atom.xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>【サイトタイトル】</title>
<!-- サイトのURL -->
<link rel="alternate" href="https://your-site.example.com/"></link>
<!-- フィードのURL -->
<link rel="self" href="https://your-site2.example.com/path/to/feed.atom.xml"></link>
<!-- フィードのID「tag:【サイトドメイン】,【公開年(月日)】:【URL】」 -->
<id>tag:your-site.example.com,2023:/</id>
<!-- フィードの最終更新日時 -->
@amane-katagiri
amane-katagiri / feedgen.py
Last active June 2, 2023 14:07
CSVっぽいテキストからAtomフィードを生成する
View feedgen.py
#!/usr/bin/env python3
# ##### つかいかた #####
#
# 実行前に `pip install feedgenerator` でライブラリをインストールしてください
#
# 例1: ./feedgen.py
# => サンプル入力からフィードを生成して標準出力に表示します
# 例2: ./feedgen.py input.txt
# => input.txtの内容からフィードを生成して標準出力に表示します
@amane-katagiri
amane-katagiri / message.txt
Created July 19, 2022 01:15
Last weekend’s Revue outage
View message.txt
Between 1:30pm ET on Friday, June 8, and around 6:15pm ET on Saturday, June 9, the Revue website was inaccessible.
We are sorry for the inconvenience this caused, and would like to explain what happened.
First off, some things to know:
Scheduled newsletter issues that were sent during the outage will have impacted delivery, but this incident will not affect future delivery
Analytics and aggregated data regarding your newsletters continued normally
The problem was caused by a Domain Name System (“DNS”) issue, which affected Revue between the hours stated above. The team worked hard to resolve the issue as swiftly as possible.
Once the issue was resolved, Revue came back online for a lot of people — but DNS changes can take up to 24 hours to propagate globally, which led to some people experiencing the outage for longer than others.
We sincerely apologize and we have taken the feedback you have shared into account. Our @TwitterWrite team will ensure that transparent, clear communication continues t
@amane-katagiri
amane-katagiri / emoji_search.json
Created July 9, 2022 09:08
JSON file mapped from emoji alias to twemoji image (72x72 png).
View emoji_search.json
{
":grinning:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f600.png",
":smiley:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f603.png",
":smile:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f604.png",
":grin:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f601.png",
":laughing:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f606.png",
":satisfied:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f606.png",
":sweat_smile:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f605.png",
":joy:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f602.png",
":rofl:": "https://raw.githubusercontent.com/twitter/twemoji/master/assets/72x72/1f923.png",
@amane-katagiri
amane-katagiri / tokyu-stations.csv
Last active June 18, 2022 17:47
東急線全96駅の一覧
View tokyu-stations.csv
えきめい 駅名
あおばだい 青葉台
あざみの あざみ野
いけがみ 池上
いけじりおおはし 池尻大橋
いしかわだい 石川台
いちがお 市が尾
うのき 鵜の木
えだ 江田
えばらなかのぶ 荏原中延
@amane-katagiri
amane-katagiri / test-former.ics
Last active June 14, 2022 15:24
Complete/Corrupted iCalendar files, fetched from Proton Calendar. ( See https://ama.ne.jp/post/proton-calendar-0x85/ )
View test-former.ics
BEGIN:VCALENDAR
PRODID:-//Proton AG//ProtonCalendar 1.0.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:corrupted calendar
X-WR-TIMEZONE:Asia/Tokyo
REFRESH-INTERVAL;VALUE=DURATION:PT240M
X-PUBLISHED-TTL:PT240M
BEGIN:VTIMEZONE
@amane-katagiri
amane-katagiri / build.sh
Last active June 26, 2022 08:43
Single binary HTTP server written in Go embedded with all static files.
View build.sh
#!/bin/bash -ue
if [ "$#" -lt 3 ]; then
echo "$0 BINARY_PREFIX STATIC_ROOT_DIR OUTPUT_DIR" >&2
exit 1
fi
export GOVER=1.18
export SUGOI_SRC='https://gist.githubusercontent.com/amane-katagiri/7b9e09f27d329515f423c97da35335b1/raw/0d1867886128375e30383f7b9aa470ff337a68a5/sugoi.go'
export PREFIX="$1"
@amane-katagiri
amane-katagiri / remove-RG60289.txt
Last active December 22, 2021 01:28
みんなで翻訳(ミンナデホンヤク)RG60289 を新着作品一覧から取り除くブックマークレットです。
View remove-RG60289.txt
javascript:(function(){Array.from(document.querySelectorAll('.maker_name a')).filter(function(x){return x.href.endsWith('RG60289.html')}).map(function(x){x.closest('.n_worklist_item').remove()})})();
@amane-katagiri
amane-katagiri / main.md
Last active September 27, 2021 17:58
busybox crond と non-root cronfile
View main.md

/* この記事は、ライフ 人間と科学シリーズ(Plume)の閉鎖処理の一環として、投稿した情報の整理を行うために書かれた。 */

busybox crondでは、root所有ではないcronfileを黙ってスキップしてしまうらしい: dockerでBusyBox crondが動かない – numa blog

通常のcrondならエラーが出るっぽい: /etc/cron.dへ置くファイルにはownerとpermissionに制約があるっぽい - モヒカンメモ

$ echo '0 0 * * * root true' > root
$ docker run --rm -v $(pwd)/root:/etc/crontabs/root --init alpine timeout 3 \
  sh -c 'mount | grep /etc/crontabs/root; \