Skip to content

Instantly share code, notes, and snippets.

View kun432's full-sized avatar

Kuniaki Shimizu kun432

View GitHub Profile
@kun432
kun432 / コード.gs
Last active September 18, 2022 23:38
3,4コーナーの位置取りから隊列を可視化する
function createTairetsu() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
sheet.insertColumnBefore(14);
sheet.insertColumnBefore(16);
sheet.getRange('N1').activate();
sheet.getCurrentCell().setValue('前走:3コーナー推定隊列');
sheet.getRange('N2').activate();
sheet.getCurrentCell().setFormula('=IFERROR(CONCATENATE(REPT(" ",M2-1),CHAR(M2+CODE("①")-1),REPT(" ",18-M2)),REPT("―",18))');
sheet.getActiveRange().autoFill(sheet.getRange(2,14,ss.getLastRow() - 1, 1), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
@kun432
kun432 / config.json
Last active February 6, 2022 14:21
CWAgentのサンプル
{
"agent": {
"metrics_collection_interval": 60,
"run_as_user": "root"
},
"metrics": {
"append_dimensions": {
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
"ImageId": "${aws:ImageId}",
"InstanceId": "${aws:InstanceId}",
@kun432
kun432 / index.md
Last active January 16, 2022 17:40
firewall-cmdでユーザ定義のサービスを追加する

例えば、sshで10022を追加したい

$ cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/ssh-10022.xml
$ vi /etc/firewalld/services/ssh-10022.xml
<?xml version="1.0" encoding="utf-8"?>

変更前

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
@kun432
kun432 / index.js
Created January 3, 2022 16:43
Voiceflow Dialog Management API LINEサンプル
'use strict';
const line = require('@line/bot-sdk');
const express = require('express');
const Axios = require("axios");
// create LINE SDK config from env variables
const config = {
channelAccessToken: process.env.LINE_CHANNEL_ACCESS_TOKEN,
channelSecret: process.env.LINE_CHANNEL_SECRET,
@kun432
kun432 / index.js
Created December 31, 2021 19:56
Voiceflow Dialog Management APIサンプル
const axios = require("axios");
const { cli } = require("cli-ux");
const API_KEY = "YOUR_API_KEY_HERE";
const VERSION_ID = "YOUR_VERSION_ID_HERE";
async function interact(userID, request) {
console.log("...");
const response = await axios({
@kun432
kun432 / gist:1dc643ae578c5a3f0a874ec363887a6e
Created December 6, 2021 02:05
amazon linux 2のsshd_config
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@kun432
kun432 / index.md
Last active November 30, 2021 13:06
おうちkubernetes

構成

master x 1, worker x2の構成 eth0がサービス用、wlan0を管理用に使う

  • k8s-master
    • eth0: 192.168.100.21/24
    • wlan0: 192.168.200.21/24
  • k8s-worker1
    • eth0: 192.168.100.31/24
@kun432
kun432 / gist:9d46e42684f501fad91c0b56f63651e1
Last active November 16, 2021 02:32
ssm parameters storeから/etc/hosts.allowを作る
$  aws ssm get-parameters-by-path --path "/hosts" --region ap-northeast-1
{
    "Parameters": [
        {
            "Name": "/hosts/sample-1",
            "DataType": "text",
            "LastModifiedDate": 1637029822.924,
            "Value": "111.111.111.111\n222.222.222.221\n222.222.222.223",
            "Version": 2,
@kun432
kun432 / index.md
Created October 31, 2021 15:58
今更denyhosts

epelにパッケージはもうないので、直接。

$ rpm -Uvh https://rpmfind.net/linux/dag/redhat/el7/en/x86_64/dag/RPMS/denyhosts-2.6-5.el7.rf.noarch.rpm

設定ファイルはこれだけ。

$ tree /etc/denyhosts