Skip to content

Instantly share code, notes, and snippets.

Avatar
💤

kyontan kyontan

💤
View GitHub Profile
@kyontan
kyontan / README.md
Last active Aug 6, 2021
ggr: get github link
View README.md

ggr: get github link

Usage

$ ls
hoge.sh
$ ggr hoge.sh
https://github.com/org/repo/blob/commithash/path_to_hoge_sh/hoge.sh
$ ggr hoge.sh 4
@kyontan
kyontan / README.md
Created Aug 4, 2021
aws assume-role helper
View README.md

aws assume-role helper script

Usage

You can use:

  1. aws command with credentials (that is already assume-role'ed) via: $ assume aws ...
  2. Set assume-role'ed credentials to current shell via: eval $(assume)

Settings

@kyontan
kyontan / clustername-0-mysqld.log
Created Jul 29, 2021
moco-cluster failed to create cluster log
View clustername-0-mysqld.log
2021-07-29T03:11:56.234169Z 0 [Note] [MY-010098] [Server] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-07-29T03:11:56.234218Z 0 [Note] [MY-010949] [Server] Basedir set to /usr/local/mysql/.
2021-07-29T03:11:56.234230Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.25) starting as process 1
2021-07-29T03:11:56.436463Z 0 [Note] [MY-012366] [InnoDB] Using Linux native AIO
2021-07-29T03:11:56.436607Z 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2021-07-29T03:11:56.438916Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-29T03:11:56.439002Z 1 [Note] [MY-013546] [InnoDB] Atomic write enabled
2021-07-29T03:11:56.439053Z 1 [Note] [MY-012932] [InnoDB] PUNCH HOLE support available
2021-07-29T03:11:56.439084Z 1 [Note] [MY-012944] [InnoDB] Uses event mutexes
2021-07-29T03:11:56.439112Z 1 [Note] [MY-012945] [InnoDB] GCC builtin __atomic_thread_fence() is used for memory barrier
@kyontan
kyontan / .bash_profile
Created Jul 19, 2021
envchain completion (わからん)
View .bash_profile
function _delegate() {
local cur subs
cur="${COMP_WORDS[COMP_CWORD]}" # partial word, if any
subs=$(envchain -l)
# echo "cword: $COMP_CWORD"
# echo "cw: ${COMP_WORDS[COMP_CWORD]}"
# echo "cl: ${COMP_LINE}, ccw: ${COMP_CWORD}, cp: ${COMP_POINT}, cw3: ${COMP_WORDS[2]}"
if [[ $COMP_CWORD == 1 ]]; then
# complete with the list of subcommands
@kyontan
kyontan / README.md
Created Jul 19, 2021
aws assume-role helper for aws cli
View README.md

To use this script, set environment variables below:

AWS_ROLE_ARN=arn:aws:iam::XXX:role/XXX
AWS_ROLE_SESSION_NAME=a_role_accessed_from_cli
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
@kyontan
kyontan / usage.sh
Created Jun 20, 2021
Use AWS CLI to access MinIO
View usage.sh
$ envchain -s minio AWS_ACCESS_KEY_ID
minio.AWS_ACCESS_KEY_ID: XXX
$ envchain -s minio AWS_SECRET_ACCESS_KEY
minio.AWS_SECRET_ACCESS_KEY: XXX
$ envchain minio docker run --rm -it -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY amazon/aws-cli --endpoint-url https://[MinIO Endpoint] s3 ls
@kyontan
kyontan / deployment.yaml
Created Jun 19, 2021
Migrate existing WordPress to bitnami/wordpress-nginx
View deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: wordpress
name: blog
namespace: default
spec:
replicas: 1
selector:
@kyontan
kyontan / bash_profile.bash
Created Jun 10, 2021
envchain autocompletion (wip)
View bash_profile.bash
# not used, copied function body into _delegate
function _executables {
local exclude=$(compgen -abkA function | sort)
local executables=$(
comm -23 <(compgen -c) <(echo $exclude)
type -tP $( comm -12 <(compgen -c) <(echo $exclude) )
)
COMPREPLY=( $(compgen -W "$executables" -- ${COMP_WORDS[COMP_CWORD]}) )
}
@kyontan
kyontan / gp_latest_photo_url
Created May 9, 2021
GoPro interval photo taker (Hero5)
View gp_latest_photo_url
#!/bin/bash
tmpfile=$(mktemp)
while true; do
curl --silent http://10.5.5.9/gp/gpMediaList > $tmpfile
grep "busy" $tmpfile > /dev/null
if [ $? -eq 1 ]; then break; fi
sleep 1
done
@kyontan
kyontan / fanboxdl.rb
Last active May 31, 2021
Pixiv FANBOX downloader
View fanboxdl.rb
#!/usr/bin/env ruby
require "net/http"
require 'net/https'
require "uri"
require "json"
require "fileutils"
require "date"
def fetch(url, sessid)