Skip to content

Instantly share code, notes, and snippets.

View matsubo's full-sized avatar

Yuki Matsukura matsubo

View GitHub Profile
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: [192.168.1.16/24]
nameservers:
addresses: [192.168.1.1, 8.8.8.8, 8.8.4.4]
optional: true
routes:
@matsubo
matsubo / corporation.teraren.com.yml
Last active October 28, 2021 14:15
法人番号検索APIのAPI仕様書 https://corporation.teraren.com/
openapi: 3.0.3
info:
version: 0.0.2
title: 法人番号検索API
description: https://corporation.teraren.com/ にて提供している法人番号検索APIの仕様書
license:
name: This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
contact:
name: Yuki Matsukura
url: https://twitter.com/matsubokkuri
[08-Oct-2021 02:37:19 UTC] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, string given in /home/matsu/Sites/teraren.com/diary/wp-content/plugins/google-sitemap-generator/sitemap-builder.php:475
Stack trace:
#0 /home/matsu/Sites/teraren.com/diary/wp-includes/class-wp-hook.php(303): GoogleSitemapGeneratorStandardBuilder->Index(Object(GoogleSitemapGenerator))
#1 /home/matsu/Sites/teraren.com/diary/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#2 /home/matsu/Sites/teraren.com/diary/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#3 /home/matsu/Sites/teraren.com/diary/wp-content/plugins/google-sitemap-generator/sitemap-core.php(1623): do_action('sm_build_index', Object(GoogleSitemapGenerator))
#4 /home/matsu/Sites/teraren.com/diary/wp-content/plugins/google-sitemap-generator/sitemap-loader.php(327): GoogleSitemapGenerator->ShowSitemap(Array)
#5 /home/matsu/Sites/teraren.com/diary/wp-content/plugins/google-sitemap-generator/sitemap-l
<!-- wp:heading -->
<h2>概要</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":9874} -->
<figure class="wp-block-image"><img src="https://matsu.teraren.com/blog/wp-content/uploads/2020/01/image-17.png" alt="Jun Murai" class="wp-image-9874"/></figure>
<!-- /wp:image -->
<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>「日本のインターネットの父」と呼ばれる<a href="http://www.asahi.com/topics/word/%E6%85%B6%E5%BF%9C%E5%A4%A7%E5%AD%A6.html">慶応大</a>環境情報学部教授の村井純さん(64)が定年を迎え、16日、最終講義があった。村井さんは「インターネットに国境はない。国や政府が分断したり規制しようとしたりする試みは続くだろうが、若い人たちで守ってほしい」と呼びかけた。</p><cite><a href="https://www.asahi.com/articles/ASN1J6FPYN1JULBJ00N.html">https://www.asahi.com/</a></cite></blockquote>

Session Managerを利用するときの制限のかけかた

前提

  • Session Managerをデフォルトで使うと sudoが可能なssm-userユーザを使ってログインすることとなる。

sudoさせたくない場合

  • ssm-userとは別のユーザアカウントをログイン先のOS上で作成する
    • sudo権限は付与しない
@matsubo
matsubo / container.sh
Created May 19, 2021 01:20
yarn 2 + webpacker test
gem i rails
curl -sL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
npm install -g yarn
rails new myapp --webpack
cd myapp/
yarn set version berry
yarn install
bin/webpack-dev-server
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())

Usage

"very long time task" | notify
root@ef0f9d3cc50e:/app# diff /usr/local/bundle/gems/actionpack-5.2.5/lib/action_controller/metal/request_forgery_protection.rb /usr/local/bundle/gems/actionpack-5.2.4.5/lib/action_controller/metal/request_forgery_protection.rb --color
323a324,328
> one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)
> encrypted_csrf_token = xor_byte_strings(one_time_pad, raw_token)
> masked_token = one_time_pad + encrypted_csrf_token
> Base64.urlsafe_encode64(masked_token, padding: false)
>
336c341
< masked_token = Base64.urlsafe_decode64(encoded_masked_token)
---