Skip to content

Instantly share code, notes, and snippets.

@kenzo0107
kenzo0107 / show_list_of_running_aws_resources.sh
Created December 1, 2023 07:09
show list of running AWS resources
#!/bin/bash
profiles=(
<profile names in ~/.aws/credentials>
)
for profile in ${profiles[@]}; do
awsume $profile --session-name "kenzo.tanaka" --output-profile tmp > /dev/null 2>&1
account_id=$(aws sts get-caller-identity --profile tmp --query 'Account' --output text)
if [ -z "$account_id" ]; then
@kenzo0107
kenzo0107 / list_of_ec2_instance_names.sh
Last active November 7, 2023 06:27
Display a list of EC2 instance names.
aws ec2 describe-instances --query 'Reservations[*].Instances[*].Tags[?Key == `Name`].Value' --output text
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.6
BuildVersion: 19G2021
```
$ ansible all -m ping
FAILED! => {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}
@kenzo0107
kenzo0107 / ssm.go
Created February 1, 2021 14:23
get ssm parameters in Go
package awsapi
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
)
// SSMIface : -
type SSMIface interface {
@kenzo0107
kenzo0107 / gist:1ae95b1c17ce809274934e663b2f928b
Created October 11, 2020 14:12
Fix: "node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)" on Raspberry PI
set -i -e "s|jessie|stretch|g" /etc/apt/sources.list
sudo apt-get update
sudo apt-get install gcc-6 g++-6
// link gcc 6
cd /usr/bin
$ sudo rm gcc g++
$ sudo ln -s gcc-6 gcc
$ sudo ln -s g++-6 g++
locals {
a_ips = ["93.184.216.34/32"] # dummy A company ip
}
# for log
resource "aws_s3_bucket" "logs" {
bucket = "hoge.logs"
acl = "log-delivery-write"
versioning {
package main
import (
"fmt"
"github.com/go-playground/validator"
)
type User struct {
FirstName string `validate:"required"` //必須

Keybase proof

I hereby claim:

  • I am kenzo0107 on github.
  • I am kenzo0107 (https://keybase.io/kenzo0107) on keybase.
  • I have a public key ASDS2szFSmiEIGa57wzFOkHyCYi3cmkSgMx8TKVpa2HBDQo

To claim this, I am signing this object:

package main
import (
"errors"
"fmt"
"go.uber.org/multierr"
)
func step1() error {
// 【TRY】画像変換コマンドを作ろう
package main
import (
"fmt"
"image/jpeg"
"image/png"
"log"
"os"
"path/filepath"