Skip to content

Instantly share code, notes, and snippets.

View kawaz's full-sized avatar
🏠
Working from home

Yoshiaki Kawazu kawaz

🏠
Working from home
View GitHub Profile
@kawaz
kawaz / Dockerfile
Created August 2, 2019 03:37 — forked from jgamblin/Dockerfile
Apple_Blee Dockerfile
FROM ubuntu:18.04
RUN apt-get update && \
apt-get upgrade -y
RUN apt-get update && \
apt-get install -y \
bluetooth \
bluez \
cmake \
@kawaz
kawaz / DefaultKeyBinding.dict
Last active May 14, 2021 05:52
macOSのテキスト系コンポーネントでのキーカスタマイズ
// https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html
// ^ for Control
// $ for Shift
// ~ for Option
// @ for Command
// # for numeric keypad
{
// home/end
"\UF729" = "moveToBeginningOfLine:";
@kawaz
kawaz / install-fonts-HackGen.sh
Last active January 23, 2021 14:51
HackGen フォントを入れる(最近はもう `brew install --cask homebrew/cask-fonts/font-hackgen` だけで行ける)
#!/bin/bash
set -e
latest_zip=$(curl -sL https://api.github.com/repos/yuru7/HackGen/releases/latest | jq -r '.assets|map(select(.name|test("^HackGen_v.*\\.zip$")))[].browser_download_url')
d=$(mktemp -d "${TMPDIR:-/tmp}/${1:-install-fonts-HackGen.sh}.XXXXXXXXXX")
curl -sL "$latest_zip" | tar xz -C "$d"
mv "$d"/*.ttf ~/Library/Fonts
rm -rf "$d"
fc-cache -vf
@kawaz
kawaz / nodejs-schedule.sh
Last active March 1, 2019 05:24
https://github.com/nodejs/Release/blob/master/schedule.json を用途別に使いやすく整形するスクリプト
curl -sL https://raw.githubusercontent.com/nodejs/Release/master/schedule.json | jq --arg today "$(date -u +%Y-%m-%d)" '
. as $a | keys | map({release:.}+$a[.]) | sort_by(.start) | reverse |
{
pending: map(select(.start>$today)),
current: map(select(.start<=$today and .lts==null))[0:1],
active_lts: map(select(.lts and .lts<=$today and .maintenance>$today)),
maintenance_lts: map(select(.lts and .lts<=$today and .maintenance<=$today and .end>$today)),
end: map(select(.end<=$today))
}'
@kawaz
kawaz / install-pam_tid-and-pam_reattach.sh
Last active March 22, 2024 06:20
macOSの sudo で TouchID が使えるようにする(tmux内の利用も対応)
#!/bin/bash
# Qiita記事 https://qiita.com/kawaz/items/0593163c1c5538a34f6f
set -e
set -o pipefail
# pam_tidの存在チェック(間違えてLinux環境などで実行されたら中断する)
[[ -f /usr/lib/pam/pam_tid.so.2 ]] || exit 1
[[ "${OSTYPE:0:6}" == "darwin" ]] || exit 1
# /etc/pam.d/sudo を念のためターミナルに出力しておく(似非バックアップ)
@kawaz
kawaz / search-iphone.js
Created February 6, 2019 02:59
iPhoneを探す的なことをするTwilioFunctions
const FUNC_PATH = '/search-iphone';
const FROM = '+8150XXXXXXXX'; //Twilioで購入済みの電話番号
//電話番号リスト。冗長だけどとりあえずキーワード複数に同じ番号を定義しとく
const TO_NUMBERS = {
'お父さん': '+8190XXXXXXXX',
'父さん': '+8190XXXXXXXX',
'お母さん': '+8190YYYYYYYY',
'母さん': '+8190YYYYYYYY',
};
//電話に出たときに再生されるメッセージ(適当)
#!/bin/bash
set -e
set -o pipefail
t=$(mktemp -d -p "${TMPDIR:-/tmp/}" -t build-qpac.XXXXXXXXXX)
dist="$t/dist"
build="$t/build"
yum install -y gcc zlib-devel
git clone --depth=1 https://github.com/gpac/gpac.git "$build"
cd "$build"
@kawaz
kawaz / q.js
Last active June 14, 2023 03:16
document.querySelectorAll のショートハンド関数。NodeList じゃなくて配列で返してくれます。::shadow に自前対応済み!
// const q = (s,r)=>[...(r||document).querySelectorAll(s)];
const q = (selector,root) =>
selector.split(/::shadow\s*/)
.reduce((parents,selector,idx) =>
parents.flatMap(parent =>
selector=="" ? (idx==0?parent:parent.shadowRoot) : [...(idx==0?parent:parent.shadowRoot).querySelectorAll(selector)]
)
, [root||document]
)
#!/bin/bash
brew tap mscharley/homebrew
brew install --HEAD alacritty
ln -s /usr/local/opt/alacritty/Applications/Alacritty.app /Applications/
@kawaz
kawaz / plaubook-install-docker.yml
Created September 21, 2018 02:23
Dockerを入れるプレイブック。docker-compose とか最新バージョンを取れるようにした。
- hosts: all
become: yes
tags: docker
tasks:
- name: docker install
block:
- name: install docker
yum: name=docker
- name: enable service (upstart)
service: name=docker state=started enabled=yes