Skip to content

Instantly share code, notes, and snippets.

@yyano
yyano / get_post_stream.php
Created April 14, 2018 08:11
GET/POSTとStreamのテスト用php
<?php
$server = var_export( $_SERVER, true );
file_put_contents( date('YmdHis')."_S.txt", var_export( $server,true ) );
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'POST') {
$post = var_export( $_POST, true );
file_put_contents( date('YmdHis')."_P.txt", var_export( $post,true ) );
}
@yyano
yyano / convertFixText.ps1
Created March 19, 2019 02:26
日本語が混じる固定長のShift_JISファイルの特定位置の文字を編集(削る)するPowershell
# 固定長のShift_JISファイルの特定位置の文字を削除する
$filename = "hogehoge.txt"
$tempfile = "ZZZZZ_$filename"
$enc = [Text.Encoding]::GetEncoding("Shift_JIS")
$fhIn = New-Object System.IO.StreamReader($filename, $enc)
$fhOut = New-Object System.IO.StreamWriter($tempfile, $false, $enc)
$isCuted = $FALSE
# 1行ずつ処理
while (($l = $fhIn.ReadLine()) -ne $null) {
@yyano
yyano / ec2-schedule-start.js
Created March 27, 2019 00:26
AWS Lambda - node.js 6.10 でEC2インスタンスを起動したり止めたり
var AWS = require('aws-sdk');
const ec2 = new AWS.EC2();
exports.handler = (event, context, callback) => {
if(typeof(event.ec2id) !== "undefined") {
ec2.startInstances({InstanceIds: [event.ec2id]}).promise()
.then((r) => {
console.log("START EC2 instance", event.ec2id);
callback(null, 'START EC2 instance: ' + event.ec2id);
@yyano
yyano / 2019-04-05.md
Last active April 7, 2019 04:54
Raspberry Pi 3B+セットアップメモ

2019/04/05時点

Install Raspbian

@yyano
yyano / Growi_API.md
Last active April 25, 2019 01:12
GrowiのAPIについて

はじめに

API

method path parameter others parameters
pages.list GET user ページの一覧を取得
pages.create POST ページを作成
pages.update POST ページを更新
pages.get GET ページを取得
pages.seen POST ページのタグを取得
@yyano
yyano / make_amazon_workspaces_list.sh
Created June 20, 2019 00:29
Amazon Workspacesの一覧を作成する
#!/bin/bash
aws workspaces describe-workspaces > workspaces.json
cat workspaces.json | jq -r '.["Workspaces"][] | [.DirectoryId, .UserName, .ComputerName, .WorkspaceId, .IpAddress, .BundleId, .WorkspaceProperties.RunningMode, .WorkspaceProperties.ComputeTypeName, .WorkspaceProperties.RootVolumeSizeGib, .WorkspaceProperties.UserVolumeSizeGib, .WorkspaceProperties.RunningModeAutoStopTimeoutInMinutes] | @csv' > workspaces.csv
aws workspaces describe-workspace-bundles > bundles.json
cat bundles.json | jq -r '.["Bundles"][] | [.BundleId, .Name, .Description ] | @csv' > bundles.csv
rm taglist.csv
for f in `cat workspaces.json | jq -r '.["Workspaces"][] | .WorkspaceId'`; do
aws workspaces describe-tags --resource-id $f | jq -r '.["TagList"][] | ["'$f'", .Key, .Value] | @csv' >> taglist.csv
@yyano
yyano / php-composer.sh
Created August 18, 2019 14:12
php composerを早くする設定。日本国内向け
composer config -g repositories.packagist composer https://packagist.jp
composer global require hirak/prestissimo
@yyano
yyano / readme.md
Last active November 9, 2019 08:18
sudo apt update
sudo apt upgrade
sudo vi /etc/apt/sources.list

2020/06/07

はじめに

RaspberryPi4BにUbuntu20.04LSTをインストールする。

メモ

  • Google chrome の ubuntu版もあるけど、ARM環境のためRapberryPiのUbuntuでは使えない。

download