Skip to content

Instantly share code, notes, and snippets.

View matsubo's full-sized avatar

Yuki Matsukura matsubo

View GitHub Profile

APC upsd mackerel plugin

Screenshot

image

Setup

@matsubo
matsubo / credit_card_bin_codes.md
Last active June 11, 2024 05:23
Credit Card Bin Codes

概要

クレジットカード番号には法則があり、先頭6桁でカードの種類を識別、分類することができる。

詳細はISO/IEC 7812で規定されている。

ISO/IEC 7812 - Wikipedia https://ja.wikipedia.org/wiki/ISO/IEC_7812

先頭の6桁を銀行識別番号(Bank Identification Number、略称:BIN)ないしは発行者識別番号(Issuer Identification Number、略称:IIN)と呼び、この先頭6桁でカード発行会社(イシュア、issuer)が判るようになっている。

@matsubo
matsubo / gist:cb875c98b3fd740abb24dd9f8f33d8a0
Created May 19, 2024 03:13
mysql 8.4に対応するためにパスワードのプラグインを変更する方法
# dockerコンテナの場合は手動で立ち上げて、そのコンテナにexecで入ってローカルに接続して変更する
ALTER USER 'root'@'localhost' IDENTIFIED with caching_sha2_password BY 'xxxxxxxxx'
ALTER USER 'root'@'%' IDENTIFIED with caching_sha2_password BY 'xxxxxxxxx'
@matsubo
matsubo / gist:dadcfc7554bc62855352b899bf5a7348
Created May 15, 2024 21:55
Delete all article using wp-cli.
$ wp post list| awk '{print $1} '| xargs -n 1 -I XXX wp post delete XXX --force
@matsubo
matsubo / gist:ac31be9578834db85e034ac54c0b433f
Created January 21, 2024 15:05
install nodejs oneliner on Ubuntu or Debian
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
@matsubo
matsubo / commit-msg
Created January 17, 2024 13:01 — forked from iberianpig/commit-msg
IssueID_xxxxなブランチ名の時に自動でコミットメッセージの先頭に[#IssueID]を付与するrubyスクリプト
#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file, :encoding => Encoding::UTF_8)
# remove prefix issue number like [#1234] from COMMIT_EDITMSG
message = message.sub(/^\[#[0-9A-Za-z_].*\]/, "")
# remove comment
message = message.gsub(/^#(?! ------------------------ >8 ------------------------).*\n|^\n/, "")
@matsubo
matsubo / README.md
Last active December 20, 2023 11:39
@matsubo
matsubo / autofill.js
Last active December 16, 2023 17:23
法人番号検索API サンプルコード
document.getElementById('s').addEventListener('keyup', async (e) => {
if (e.key !== 'Enter') return;
const s = e.target.value;
const corporateInfoUrl = `https://corporation.teraren.com/corporations.json?s=${s}`;
try {
const corporateResponse = await fetch(corporateInfoUrl);
const { items: [corporateData] } = await corporateResponse.json();
document.getElementById('postcode').addEventListener('keyup', function(e) {
if (!e.key.match(/[0-9]/)) return;
const postcode = e.target.value;
if (postcode.length !== 7) return;
const url = `https://postcode.teraren.com/postcodes/${postcode}.json`;
fetch(url)
.then(response => response.json())