Skip to content

Instantly share code, notes, and snippets.

View jfut's full-sized avatar

Jun Futagawa jfut

View GitHub Profile
@jfut
jfut / csrf_token.go
Last active November 22, 2024 09:56
echo + go-ozzo/ozzo-validation: CSRF Token Validation
// echo: CSRF Token Management with Session
//
// Copyright (c) 2024 Jun Futagawa (jfut)
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
package web
import (
@jfut
jfut / session.go
Last active October 17, 2024 07:52
echo + gorilla/sessions: Session Management Utility Functions
// echo + gorilla/sessions: Session Management Utility Functions
//
// Copyright (c) 2024 Jun Futagawa (jfut)
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
package common
import (
@jfut
jfut / wget-mirror-adjust
Last active August 7, 2023 07:31
wget-mirror-adjust
#!/bin/bash
#
# Mirror the page without extensions as it is.
#
# Copyright (c) 2023 Jun Futagawa (jfut)
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
set -uo pipefail
@jfut
jfut / aws-secret-cli
Last active March 26, 2023 09:14
aws-secret-cli
#!/bin/bash
#
# AWS Secrets Manager CLI for role based release files
#
# Copyright (c) 2023 Jun Futagawa (jfut)
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
# - ENV/release/secret.conf
@jfut
jfut / aws-login
Created December 29, 2022 01:30
aws-login
#!/bin/bash
#
# AWS login to the management console or instance with Session Manager or SSH
#
# Require: aws-vault
#
# Copyright (c) 2022 Jun Futagawa (jfut)
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
@jfut
jfut / monit-slack-notify
Created May 14, 2022 01:29
monit-slack-notify
#!/bin/bash
#
# Monit alert to Slack Webhook
#
# Configuration:
#
# - touch /etc/monit-slack-notify.conf
# - chmod 600 /etc/monit-slack-notify.conf
# - vi /etc/monit-slack-notify.conf
#
@jfut
jfut / aws-security-group-dump
Created April 19, 2022 12:55
aws-security-group-dump
#!/bin/bash
#
# AWS Security Group dump
#
# Supported name resolution targets:
#
# - EC2
# - RDS
# - RDS Procy
# - ElastiCache
@jfut
jfut / robocopy-backup-full.bat
Created October 6, 2021 04:45
Robocopy Backup
@echo off
::
:: フルバックアップ
::
:: 1. robocopy バックアップ
:: 2. バックアップ元のすべてのファイルのアーカイブ属性を Off に設定
:: 3. バックアップ先ディレクトリの隠し属性削除
:: 注意: 1. 実行後、2. の実行までに更新されたファイルは、
:: バックアップから漏れますが許容することにします。
::
@jfut
jfut / scoop-list-for-migration
Last active June 16, 2021 06:43
scoop-list-for-migration
#!/bin/bash
#
# scoop list for migration
APP_FAILED=""
APP_UNKOWN=""
APP_GLOBAL=""
APP_USER=""
IFS='
@jfut
jfut / moodle-v3.1.17-dbtransfer-retry.patch
Last active March 16, 2021 08:17
moodle-v3.1.17-dbtransfer-retry.patch
diff --git a/admin/tool/dbtransfer/cli/migrate.php b/admin/tool/dbtransfer/cli/migrate.php
index 0d32e2ae..dea01740 100644
--- a/admin/tool/dbtransfer/cli/migrate.php
+++ b/admin/tool/dbtransfer/cli/migrate.php
@@ -49,6 +49,10 @@ Options:
--dbport=NUMBER Database port.
--prefix=STRING Table prefix for above database tables.
--dbsocket=PATH Use database sockets. Available for some databases only.
+--dbcollation=COLLATION Use database collation for mysql/mariadb
+-r, --retry=BOOLEAN Retry to copy tables. If the number of records is the