Skip to content

Instantly share code, notes, and snippets.

@akira345
akira345 / Dockerfile
Last active June 14, 2023 15:44
zabbix-serverを構築するdocker-compose.ymlサンプル。パスワードとかは適当に変えること。docker-proxyを使用しています。
FROM zabbix/zabbix-web-apache-pgsql:ubuntu-latest
USER root
RUN apt-get clean && apt-get update && \
apt-get -y install fonts-ipafont && \
rm -f /etc/alternatives/zabbix-frontend-font && \
rm -f /usr/share/zabbix/assets/fonts/DejaVuSans.ttf && \
update-alternatives --install /usr/share/zabbix/assets/fonts/DejaVuSans.ttf zabbix-frontend-font /usr/share/fonts/opentype/ipafont-gothic/ipagp.ttf 50 && \
update-alternatives --set zabbix-frontend-font /usr/share/fonts/opentype/ipafont-gothic/ipagp.ttf && \
chown -R www-data:www-data /usr/share/zabbix/assets/ && \
chmod -R 744 /usr/share/zabbix/assets && \
# -*- coding: utf-8 -*-
#
# STS動作確認サンプルその2
# 要 AWS SDK for Ruby V3
require 'aws-sdk-core'
require 'aws-sdk-ec2'
require 'aws-sdk-s3'
require 'yaml'
require 'pp'
@akira345
akira345 / aws_organaization.rb
Created November 15, 2017 16:18
AWS Organizationsを利用したアカウント作成の自動化及びSTSでの認証取得、SNS、CloudWatch設定サンプルです。
# -*- coding: utf-8 -*-
#
# AWS Organizationsを利用したアカウント作成の自動化(https://aws.amazon.com/jp/blogs/news/account-management-automation-using-aws-organizations/)
# をRubyに焼き直していくつか改善したもの。
# 要 AWS SDK for Ruby V3
require 'aws-sdk-core'
require 'aws-sdk-organizations'
require 'aws-sdk-sns'
require 'aws-sdk-cloudwatch'
@akira345
akira345 / get_acm.rb
Last active October 25, 2017 11:51
AWS SDK fro Ruby V3でACMに登録した証明書一覧を取得するサンプル
# -*- coding: utf-8 -*-
#
# ACMに登録された証明書を出力するサンプルスクリプトです。
# 要 AWS SDK for Ruby V3
require 'aws-sdk-core'
require 'aws-sdk-acm' # V3になって個別ロードになった。
require 'yaml'
require 'pp'
{
"title": "Harry Potter and the Philosopher's Stone",
"author": "J.K. Rowling",
"hoge": {
"stringField": "piyo",
"numField": 123,
"floatField": 20.315,
"boolField": false,
"huga": {
"piyo": ["orange","apple"]
//ルートノード
var root_node = new json_sample.RootObject();
root_node.title = "Harry Potter and the Philosopher's Stone";
root_node.author = "J.K. Rowling";
root_node.tags = new List<string> { "novel", "story", "magic" };
root_node.valiableTags = new List<object> { 123, false, "str" };
root_node.intArray = new List<int> { 1, 2, 3, 4, 5 };
root_node.floatArray = new List<double> { 1.2, 1.3, 1.4, 2.0 };
root_node.date = "2016/11/29T12:34:56.000";
using System.Collections.Generic;
namespace json_sample
{
namespace JsonNodeHoge
{
public class Huga
{
public List<string> piyo { get; set; }
}
@akira345
akira345 / template_sample.cs
Created July 31, 2017 15:01
c#でテンプレートエンジンRazorEngineを使うサンプル
using System;
using System.Windows.Forms;
using RazorEngine;
using System.IO;
using RazorEngine.Configuration;
using RazorEngine.Text;
using RazorEngine.Templating;
namespace template_sample
{
@akira345
akira345 / create_and_remove_temp_directory.cs
Created July 31, 2017 11:47
C#で一時ディレクトリ作成スニペット
//一時ディレクトリ作成
string temp_path = Path.GetTempPath();
string temp_dir_name = Path.GetRandomFileName();
string temp_dir = Path.Combine(temp_path, temp_dir_name);
try
{
if (Directory.Exists(Path.Combine(temp_path, temp_dir_name)))
{
Directory.Delete(temp_dir, true);
}
@akira345
akira345 / clone-github.rb
Created May 20, 2017 09:09
GitHubから自分のリポジトリをまとめてcloneする。(公開リポジトリのみ)
# Use 'ruby clone-github.rb'
# ユーザー名とかdepthオプションは自分で書き換えてください。
require "json"
require "open-uri"
response = open("https://api.github.com/users/Hiroto-K/repos?per_page=100").read
JSON.parse(response).each do |info|
clone_url = info["ssh_url"]
to = info["name"]