Skip to content

Instantly share code, notes, and snippets.

View toricls's full-sized avatar
🐔
Cock a doodle doo

Tori Hara toricls

🐔
Cock a doodle doo
View GitHub Profile
@toricls
toricls / gcal-labeler.gs
Last active November 14, 2022 03:21
A GAS (Google Apps Script) script for automated color labeling for Google (Workspace) Calendar
// ========================================================================
// gcal-labeler.gs v1.2
//
// See https://kaminashi-developer.hatenablog.jp/entry/2022/11/14/automated-labeling-for-google-calendar-using-google-apps-script for details.
// ========================================================================
// ========================================================================
// はじめてこのスクリプトを GAS に突っ込んでセットアップする際に使うパラメーター。
// 詳細は↑の記事をご覧ください。
// ========================================================================
const ENABLE_PREPARATION_MODE = true;
@toricls
toricls / omoide.md
Last active December 11, 2021 06:13
COVID-19: 実質4日間の国家による強制隔離の思い出

2021/12/7-10 で実質4日間強制隔離されていたときの思い出

  • 自分のケースでは、どの隔離施設に向かうのか、その施設がどこにあるのかはバスに詰め込まれて扉が閉まった後に知らされた
  • 自分はたまたま隔離施設が羽田空港の横にあるホテルだったため、空港で拘束されたあと、そして強制隔離明けのバス移動時間が短くて運がよかった
  • 隔離施設に到着してすぐに MySOS とは別の Web アプリを使って毎朝体温その他の情報を報告することを要求された
    • この Web アプリはとても品質が悪く、データの送信のために何回も手でリトライすることになる。使い勝手が非常に悪く、しかも毎朝これをやるのでモヤモヤした
    • (Web アプリのドメインには誰もが名前を知る日本の巨大企業の名前が入っていたが、その企業が作ったものかどうかまでは確認していないのでここには名前は書かない)
    • そもそも MySOS で毎日報告を求められる情報と中身はほぼ同じなので、無理くりまわしている現場の都合で隔離されている側に二重で報告させることにしたんだろうなと想像した
  • 隔離期間中は常に室内軟禁。本当に部屋から出られない。廊下でウォーキングとかも無理。廊下に監視担当者がいる。
  • 部屋で元気に足踏みしていたら翌日筋肉痛になった。これは施設は関係ない。
@toricls
toricls / lima-on-m1-mac-installation-guide.md
Last active February 28, 2024 10:39
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

@toricls
toricls / create-copi-dummy-env-with-default-vpc.sh
Created August 4, 2021 12:54
Copilot で App Runner サービスをデプロイしたいだけなのに `env init` で VPC が作られて悲しいので、とりあえず default VPC で無理矢理 `env init` を通してしまう図
$ defaultVpcId=$(aws ec2 describe-vpcs --region "${AWS_REGION}" \
--filter Name=isDefault,Values=true | jq -r '.Vpcs[0].VpcId')
$ subnetIds=$(aws ec2 describe-subnets --region "${AWS_REGION}" \
--filter Name=vpc-id,Values="${defaultVpcId}" \
| jq -r '.Subnets | map (.SubnetId) | join(",")')
$ copilot env init \
--name ops --profile "${AWS_PROFILE}" --region "${AWS_REGION}" \
--import-vpc-id "${defaultVpcId}" --import-private-subnets "${subnetIds}"
@toricls
toricls / Dockerfile
Created July 19, 2021 04:46
Docker-in-Docker with Ubuntu Container
FROM ubuntu:20.04
RUN set -ex \
&& apt update \
&& apt install --no-install-recommends -y \
ca-certificates curl docker.io \
# systemd is not a hard requirement for Amazon ECS Anywhere, but the installation script currently only supports systemd to run.
# Amazon ECS Anywhere can be used without systemd, if you set up your nodes and register them into your ECS cluster **without** the installation script.
systemd init \
&& rm -rf /var/lib/apt/lists/* \
@toricls
toricls / Dockerfile
Last active April 26, 2023 23:49
Docker-in-Docker with Amazon Linux 2 Container
FROM amazonlinux:2
RUN yum -y update \
# systemd is not a hard requirement for Amazon ECS Anywhere, but the installation script currently only supports systemd to run.
# Amazon ECS Anywhere can be used without systemd, if you set up your nodes and register them into your ECS cluster **without** the installation script.
&& yum -y install systemd \
&& yum clean all
RUN cd /lib/systemd/system/sysinit.target.wants/; \
for i in *; do [ $i = systemd-tmpfiles-setup.service ] || rm -f $i; done
@toricls
toricls / screenshots.applescript
Created June 29, 2021 01:15
Take screenshots with consistent size and location with AppleScript in Automator.app
set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theDirectory to POSIX path of (path to desktop)
set thePath to theDirectory & "screenCapture_" & theDate & ".png"
# -R557,308,810,513 is the rectangle option: x,y,w,h
do shell script "screencapture -R557,308,810,513 -tpng" & space & quoted form of thePath
@toricls
toricls / state-machine.json
Created June 18, 2021 07:29
Step Functions example state machine - retrying by stoppedReason of ECS task
{
"Version": "1.0",
"Comment": "Run AWS Fargate task",
"TimeoutSeconds": 900,
"StartAt": "Run Fargate Task",
"States": {
"Run Fargate Task": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"Parameters": {
@toricls
toricls / move-aws-containers-to-top.user.js
Last active June 2, 2021 03:28
AWS Containers please 🙏 - A Greasemonkey script
// ==UserScript==
// @name AWS Containers please 🙏
// @namespace https://aws.amazon.com
// @include /^https:\/\/[a-z0-9.-]*console\.aws\.amazon\.com\/.*$/
// @version 0.0.1
// @author toricls
// ==/UserScript==
(function() {
window.setTimeout(update, 1000);
@toricls
toricls / app-runner-template.yml
Created May 19, 2021 06:57
AWS App Runner CloudFormation Template generated using AWS Copilot
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation template that represents a request driven web service on AWS App Runner.
Parameters:
AppName:
Type: String
EnvName:
Type: String
WorkloadName: