Skip to content

Instantly share code, notes, and snippets.

View mtsukamoto's full-sized avatar

Makio Tsukamoto mtsukamoto

View GitHub Profile
@mtsukamoto
mtsukamoto / al2023g-budibase-userdata.txt
Created March 4, 2024 08:35
Amazon Linux 2023 (ARM) userdata to install budibase
#!/bin/bash -xe
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
export HOME="/root"
dnf update -y
dnf upgrade --releasever=2023.3.20240117 -y
# install docker
dnf install -y docker
systemctl enable --now docker
@mtsukamoto
mtsukamoto / al2023-flatpress121ja-userdata.txt
Last active March 4, 2024 08:46
Amazon Linux 2023 userdata to install flatpress 1.2.1 (japanese)
#!/bin/bash
sudo yum update -y
sudo yum install -y httpd php
curl https://github.com/flatpressblog/flatpress/archive/1.2.1.zip -O -L
curl https://hfj.sakura.ne.jp/dl/FlatPress1.2.1-LanguagePack-Japanese1.2.zip -O -L
unzip -qq 1.2.1.zip
unzip -qq FlatPress1.2.1-LanguagePack-Japanese1.2.zip
sudo \cp -r -f flatpress-1.2.1/* /var/www/html
sudo \cp -r -f FlatPress1.2.1-LanguagePack-Japanese1.2/* /var/www/html
@mtsukamoto
mtsukamoto / lambda.py
Created July 17, 2021 06:01
AWSBasics Amazon-Location-Service lambda.py modified.
from datetime import date, datetime
import json
import os
import boto3
# Update this to match the name of your Tracker resource
TRACKER_NAME = "handson-20210717"
"""
This Lambda function receives a payload from AWS IoT Core and publishes device updates to Amazon Location Service via the BatchUpdateDevicePosition API.
@mtsukamoto
mtsukamoto / Memo_Create_Azure-VM.ps1
Created April 23, 2018 05:45
Powershellから、仮想マシンサイズや仮想マシンイメージを指定して、仮想マシンを作成する手順のメモ
# Memo_Create_Azure-VM.ps1
# ----
# Powershellから、仮想マシンサイズや仮想マシンイメージを指定して、
# 仮想マシンを作成する手順のメモ
# ---- 事前準備(PowershellでAzureを操作する時の共通作業)----
# Azureにログインします(Azure Browser Shellでは、アクセス時にログインしているので不要です)。
# Login-AzureRmAccountコマンドレットを使用します。
@mtsukamoto
mtsukamoto / Get-AzureVnetSummary.ps1
Last active April 3, 2018 02:05
サブスクリプション内の仮想ネットワーク、サブネット、仮想マシンのIPアドレス構成のサマリを作成
# Get-AzureVnetSummary.ps1
# ----
# Makio Tsukamoto <tsukamoto@gmail.com>
# Initial : 2018.03.16
# Latest : 2018.04.03
# 引数の処理
Param(
[string]$SubscriptionName, # 情報取得対象のサブスクリプション名、デフォルトはカレントコンテキストのサブスクリプション
@mtsukamoto
mtsukamoto / hostServiceOps.pl
Last active August 3, 2016 00:49
Start, Stop, or Stats for ESXi services on remote server.
#!/usr/bin/perl -w
# hostServiceOps.pl
# ----
# Makio Tsukamoto modified hostServiceManagement.pl
# for using on Windows (disable ANSI COLOR)
# 08/02/2016
# https://github.com/mtsukamoto
@mtsukamoto
mtsukamoto / Tabelog_IsSmokeFree.pl
Created June 11, 2016 17:16
リスト中の食べログURLを取得し「店名」「営業時間」「禁煙・喫煙」などを出力
use strict;
use warnings;
use utf8;
use Encode;
use Web::Scraper;
use URI;
my ($opts, @urls) = &parse_args(@ARGV);
@mtsukamoto
mtsukamoto / excel2csvs.pl
Created June 29, 2015 06:40
Excelファイル内の全シートをCSV保存するPerlスクリプト
#!perl
# Written by Makio Tsukaoto (tsukamoto at gmail.com)
use strict;
use warnings;
use File::Spec;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
our $VERSION = "0.01";
use utf8;
use WWW::Mechanize;
use Encode qw(encode decode);
my $auth = {
email => $ENV{'BOOKSCAN_MAIL'},
password => $ENV{'BOOKSCAN_PASS'},
};
my $mech = WWW::Mechanize->new;
$mech->env_proxy();
@mtsukamoto
mtsukamoto / MySAXHandler.pm
Created April 16, 2013 07:01
My sample XML::SAX handler module. With this sample handler, current path and path nodes' name are available in "characters" sub.
package MySAXHandler;
use base qw(XML::SAX::Base);
# --- SYNOPSYS ---
# use XML::SAX;
# use MySAXHandler;
# my $parser = XML::SAX::ParserFactory->parser(Handler => MySAXHandler->new);
# $parser->parse_uri("sample.xml");
sub start_document {