Skip to content

Instantly share code, notes, and snippets.

View haxibami's full-sized avatar
🌟
mythfinder

haxibami haxibami

🌟
mythfinder
View GitHub Profile
@haxibami
haxibami / README.md
Created March 22, 2024 09:50
A script to sign in to Microsoft Entra ID using passkeys in unsupported environments (e.g. Firefox for Linux)

A script to sign in to Microsoft Entra ID using passkeys in unsupported environments (e.g. Firefox for Linux)

About

The latest versions of Firefox for Linux support FIDO2 / passkey sign-in. This works as expected for most websites, including login.live.com (which is an endpoint for personal MS account).

However, login.microsoftonline.com, which is for MS Entra ID, intentionally blocks this feature on Firefox. This is probably because Firefox for Linux is not in the Officially supported environments.

This can be overridden in two ways. One is to change the User-Agent (by devtool or some extension), and the other is to rewrite configuration objects for login.microsoftonline.com web app. This script does the latter.

@haxibami
haxibami / README.md
Last active October 31, 2024 02:27
Appleのサイトから日本語向けのSan Franciscoフォント(`SF Pro JP`)をダウンロードするスクリプト
@haxibami
haxibami / README.md
Last active February 22, 2024 04:18
iwdでUTokyo Wi-Fi / Eduroamに接続する最小設定の例

iwdでUTokyo Wi-Fi / Eduroamに接続する最小設定の例

東大構内で使える無線LAN0000UTokyoeduroam)はいずれも 802.1x (EAP-PEAP方式)の認証を要求する。当然 iwd もこれに対応している。

基本的にはArchWikiの記載どおりに設定すれば接続できるが、どの設定項目が最低限必要かは実際に接続してみないとわからない(ネットワークによって異なるため)。そこで何度か試行し、最小項目のみを抜き出したのが下のファイルである。

下のファイルの必要項目を埋め、0000UTokyo.8021x および eduroam.8021x として /var/lib/iwd/ 以下に配置し、iwdを再起動すれば接続できる(iwdの全体設定 /etc/iwd/main.conf が済んでおり、DNS / DHCP等の設定が適切に行われていることが前提)。

EAP-PEAP-Phase2-Password-Hash について

@haxibami
haxibami / rehype-astro-figure.ts
Created October 3, 2023 05:44
A rehype plugin to wrap images inserted by markdown image directive (`![alt](src)`), within Astro contents
import { visit } from "unist-util-visit";
import { isMdxJsxAttribute, isMdxJsxFlowElement } from "./hast-util-node-is";
import type { Root } from "hast";
import type { Plugin } from "unified";
interface RehypeAstroFigureOptions {
/**
* Class names to add to the figure element.
@haxibami
haxibami / sway-gdb.log
Created May 27, 2023 02:33
coredumpctl gdb sway
Script started on 2023-05-27 11:25:02+09:00 [TERM="linux" TTY="/dev/tty4" COLUMNS="240" LINES="67"]
[root@Archaxibami ~]# coredumpctl gdb sway
PID: 12693 (sway)
UID: 1000 (haxibami)
GID: 1000 (haxibami)
Signal: 11 (SEGV)
Timestamp: Sat 2023-05-27 11:23:00 JST (2min 17s ago)
Command Line: /usr/bin/sway -d -V -c /etc/sway/config
Executable: /usr/bin/sway
Control Group: /user.slice/user-1000.slice/session-7.scope
@haxibami
haxibami / sway.log
Created May 27, 2023 02:33
WLR_RENDERER=vulkan /usr/bin/sway -d -V -c /etc/sway/config 2> sway.log
00:00:00.000 [INFO] [sway/main.c:338] Sway version 1.8.1
00:00:00.000 [INFO] [sway/main.c:339] wlroots version 0.16.2
00:00:00.001 [INFO] [sway/main.c:120] Linux Archaxibami 6.3.4-zen1-1.1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 26 May 2023 12:04:59 +0000 x86_64 GNU/Linux
00:00:00.001 [INFO] [sway/main.c:136] Contents of /etc/lsb-release:
00:00:00.001 [INFO] [sway/main.c:120] DISTRIB_ID="Arch"
00:00:00.001 [INFO] [sway/main.c:120] DISTRIB_RELEASE="rolling"
00:00:00.001 [INFO] [sway/main.c:120] DISTRIB_DESCRIPTION="Arch Linux"
00:00:00.001 [INFO] [sway/main.c:136] Contents of /etc/os-release:
00:00:00.001 [INFO] [sway/main.c:120] NAME="Arch Linux"
00:00:00.001 [INFO] [sway/main.c:120] PRETTY_NAME="Arch Linux"
# do nothing if fzf is not installed
(( ! $+commands[fzf] )) && return
# Bind for fzf history search
(( ! ${+ZSH_FZF_HISTORY_SEARCH_BIND} )) &&
typeset -g ZSH_FZF_HISTORY_SEARCH_BIND='^r'
# Args for fzf
(( ! ${+ZSH_FZF_HISTORY_SEARCH_FZF_ARGS} )) &&
typeset -g ZSH_FZF_HISTORY_SEARCH_FZF_ARGS='+s +m -x -e --preview-window=hidden'
@haxibami
haxibami / sway-freeze-crop.sh
Created February 3, 2023 07:55
Freezes the focused screen, allows capturing an area, even with floating / hover windows (ex. IME window)
#!/usr/bin/env bash
# based on the script by @lbatalha
# https://github.com/emersion/slurp/issues/104#issuecomment-1381110649
# requirements: sway, grim, slurp, swayimg, libvips, wl-clipboard
# Freezes the focused screen, allows capturing an area, even with floating / hover windows (ex. IME window)
# imagemagick and ffmpeg can also be used instead of libvips
TMPIMG="$(mktemp --suffix ss.png)"
IMGCLASS="sway-crop-screen"
FOCUSED=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)')
@haxibami
haxibami / key.md
Created February 2, 2023 11:31
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@haxibami
haxibami / gdrive-dl.md
Created April 18, 2022 10:53
GoogleDriveで閲覧できる任意の動画をダウンロードする

Google Drive で閲覧できる任意の動画をダウンロードする

概要

youtube-dl のフォークであるyt-dlpには、ブラウザの Cookie を抽出してアクセスに使用する機能(--cookies-from-browser)が付加されている。これを使うと、Google Drive で自らのアカウントが閲覧できる任意の動画を(設定の如何にかかわらず)ダウンロードできる。この意味するところは各自考えられたし。1

必要なもの

Footnotes

  1. というかこんなものを使わなくても、手の込んだ JS やら DRM やらがない時点で <video> 要素から引っ張り放題ではある。