Skip to content

Instantly share code, notes, and snippets.

View doi-t's full-sized avatar
🧗‍♂️
Be open-minded

Toshiya Doi doi-t

🧗‍♂️
Be open-minded
View GitHub Profile
@doi-t
doi-t / manage_milestones_with_gh.md
Last active December 8, 2023 18:13
Manage milestones with gh

Use gh v0.11.0 or later for the "shell" aliases.

Run the following gh alias set commands for each operation. You can confirm the created aliases with gh alias list.

gh listMilestones

gh alias set listMilestones "api graphql -F owner=':owner' -F name=':repo' -f query='
    query ListMilestones(\$name: String\!, \$owner: String\!) {
        repository(owner: \$owner, name: \$name) {
            milestones(first: 100) {
@doi-t
doi-t / protocol_buffers_and_grpc_tutorial.md
Last active July 27, 2023 11:12
Protocol Buffers & gRPC Tutorial: Python & Go
@doi-t
doi-t / setting_default_value.bash
Last active April 2, 2023 11:35
シェル変数のデフォルト値を設定する
#!/bin/bash
foo=${1:-hoge}
echo $foo #$1がなかったらhogeをデフォルト値としてfooに代入する
#var自身にデフォルト値としてhogeを代入としたいので以下のように書きたい
${var:=hoge} #このままでは、hogeが展開されてしまって、hogeなんてコマンドはないとシェル怒られる
echo "1:$var"
var=
@doi-t
doi-t / wrapper_sigaction.c
Created February 14, 2014 14:32
sigaction(2)のラッパー関数Signal
/*
Linuxカーネルのバージョンは2.6以上が前提
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <stdarg.h>
@doi-t
doi-t / getting-start-with-AWS-Batch.md
Last active January 2, 2023 09:50
A log of getting start with AWS Batch.
@doi-t
doi-t / Makefile
Created January 29, 2014 20:11
makeでライブラリ(.a)のビルドを管理するサンプル(gccとg++の混在ver)
CC := gcc
RM := rm -f
CFLAGS := -Wall
CXXFLAGS := -Wall
programs := run
.PHONY: all
all: $(programs)
@doi-t
doi-t / listup_ami_ids.sh
Last active April 14, 2022 11:41
List up all Amazon Linux AMI (HVM / 64-bit) IDs
aws ec2 describe-images --owners self amazon --filters \
Name=virtualization-type,Values=hvm \
Name=architecture,Values=x86_64 \
Name=block-device-mapping.volume-type,Values=gp2 \
| jq -r '.Images | sort_by(.Name)| .[] | select(.Platform != "windows") | .Name + ": " + .ImageId' \
| egrep 'amzn-ami-hvm|ecs-optimized|amzn2-ami-hvm|amzn2-ami-ecs'
@doi-t
doi-t / aws_lambda_cloudwatch_logs_exporter.md
Last active February 10, 2022 23:46
Export logs from CloudWatch Logs to S3 with AWS Lambda

event example

TASK_NAME=${1:-'export_logs'}
FROM=${2:-'2017-12-24 12:00'}
TO=${3:-'2017-12-24 12:05'}
cat <<-EOF > event.json
{
    "taskName": "$TASK_NAME",
    "fromTime": `gdate --date="$FROM" +%s%3N`,
 "toTime": `gdate --date="$TO" +%s%3N`
@doi-t
doi-t / Makefile
Last active February 3, 2022 05:22
GNU Make 第3版、第6章の非再帰makeのサンプルコードに対するメモ
### 非再帰的make(non-recursive make)
# ソースファイルツリーが常に整頓されている前提
# 使っていないソースファイルが紛れ込まないようにしなければならない、その辺はGitで管理する
# 内容的には "GNU Make 第3版、6章 大きなプロジェクトの管理" に載っているコードとほぼ同じ
#
### 参考
#論文: "Recursive Make Considered Harmful"
#http://miller.emu.id.au/pmiller/books/rmch/
#実際にnon-recursive makeを適用しているOSSプロダクト(OpenRADIUS)のMakefile解説(上記論文のサイトにもリンクが貼られている)
#http://evbergen.home.xs4all.nl/nonrecursive-make.html
@doi-t
doi-t / my_vs_code_settings.md
Last active January 10, 2021 04:08
wip: My VS Code Settings

Update settings.json

{
  "editor.formatOnSave": true,
  "editor.wordWrap": "on",
  "editor.insertSpaces": true,
  "editor.detectIndentation": false,