Skip to content

Instantly share code, notes, and snippets.

View sunaoka's full-sized avatar

SUNAOKA Norifumi sunaoka

View GitHub Profile
diff -urd --exclude vendor --exclude composer.lock laravel-10.0/.env laravel-11.0/.env
--- laravel-10.0/.env 2024-03-13 10:32:39
+++ laravel-11.0/.env 2024-03-13 10:32:51
@@ -1,36 +1,54 @@
APP_NAME=Laravel
APP_ENV=local
-APP_KEY=base64:SpHwH7V060ReXjch6ksAXWNLPJ9z9iPYKRSUZzTSr/g=
+APP_KEY=base64:pCIm9KJkg0GFtbzCdq0VweTp4S6S9GDhOccpZmrWp0A=
APP_DEBUG=true
+APP_TIMEZONE=UTC
aws ec2 describe-images \
  --region ap-northeast-1 \
  --query 'reverse(sort_by(Images, &CreationDate))[:1]' \
  --owners amazon \
  --filters 'Name=name,Values=al2023-ami-minimal-*-arm64' \
  --output table
{
"// Pint preset": "https://github.com/laravel/pint/blob/main/resources/presets/laravel.php",
"// PHP-CS-Fixer Configurator": "https://mlocati.github.io/php-cs-fixer-configurator",
"// binary_operator_spaces": "配列の => でキーと値のペアをそろえる",
"// blank_line_before_statement": "return や continue の前に空行は不要",
"// no_extra_blank_lines": "余分な空白行や空白行を削除(デフォルトの throw を外す。cache の直前の throw の空行が削除されるため)",
"// declare_strict_types": "declare(strict_types=1); を追加",
"// explicit_string_variable": "文字列に埋め込まれている変数を {} で囲む",
"preset": "laravel",
"cache-file": ".build/pint-cache.json",
@sunaoka
sunaoka / Mountpoint for Amazon S3 v1.0.0.md
Last active August 10, 2023 04:42
Mountpoint for Amazon S3 v1.0.0

Mountpoint for Amazon S3 v1.0.0

検証環境

cat /etc/os-release
@sunaoka
sunaoka / bootstrap5-responsive-debug.html
Last active June 23, 2023 01:08
Bootstrap5 Responsive Debug
<div id="responsive-debug" class="alert alert-danger opacity-75 position-fixed top-0 end-0 m-3" style="z-index: 2000;"></div>
<script>
const showResponsiveDebug = function () {
const breakPoint = (function (width) {
switch (true) {
case width >= 1400: return 'xxl';
case width >= 1200: return 'xl';
case width >= 992: return 'lg';
case width >= 768: return 'md';
case width >= 576: return 'sm';
@sunaoka
sunaoka / build-boost-on-macos.sh
Last active June 16, 2023 05:15
Build Boost on macOS
sudo mkdir -p /usr/local/boost
sudo chown $USER /usr/local/boost
curl -L -o boost_1_81_0.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
tar -jxvf boost_1_81_0.tar.bz2
echo 'using darwin : : clang++ ;' > user-config.jam
./bootstrap.sh --prefix=/usr/local/boost \
@sunaoka
sunaoka / PostgreSQL で JSON の数字をすべて足すクエリ.md
Created April 27, 2023 09:04
PostgreSQL で JSON の数字をすべて足すクエリ
SELECT SUM(value::INT)
FROM JSONB_ARRAY_ELEMENTS('[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]')
 sum
-----
  55
@sunaoka
sunaoka / PostgreSQL で JSON の値をキーにして出現回数をまとめて JSON にするクエリ.md
Last active April 27, 2023 09:02
PostgreSQL で JSON の値をキーにして出現回数をまとめて JSON にするクエリ
SELECT JSONB_OBJECT_AGG(value, count) AS sum
FROM (
    SELECT value ->> 0 AS value
         , COUNT(*) AS count
    FROM JSONB_ARRAY_ELEMENTS('["a", "a", "b", "a", "b", "b", "a"]')
    GROUP BY value
) x
@sunaoka
sunaoka / PostgreSQL でインデックスが張られていない外部キーを探す.sql
Last active April 21, 2023 04:52
PostgreSQL でインデックスが張られていない外部キーを探す
WITH y AS (
SELECT
pg_catalog.format('%I.%I', n1.nspname, c1.relname) AS referencing_tbl,
pg_catalog.quote_ident(a1.attname) AS referencing_column,
t.conname AS existing_fk_on_referencing_tbl,
pg_catalog.format('%I.%I', n2.nspname, c2.relname) AS referenced_tbl,
pg_catalog.quote_ident(a2.attname) AS referenced_column,
pg_relation_size( pg_catalog.format('%I.%I', n1.nspname, c1.relname) ) AS referencing_tbl_bytes,
pg_relation_size( pg_catalog.format('%I.%I', n2.nspname, c2.relname) ) AS referenced_tbl_bytes,
pg_catalog.format($$CREATE INDEX %I_%I_idx ON %I.%I(%I);$$, c1.relname, a1.attname, n1.nspname, c1.relname, a1.attname) AS suggestion
SELECT pg_stat_user_tables.*
, pg_description.description
, (pg_class.relpages::bigint * 8192) as byte
FROM pg_stat_user_tables
INNER JOIN pg_class ON pg_stat_user_tables.relid = pg_class.oid
INNER JOIN pg_description ON pg_stat_user_tables.relid = pg_description.objoid
WHERE pg_description.objsubid = 0
ORDER BY pg_stat_user_tables.relname