Skip to content

Instantly share code, notes, and snippets.

View sasukeh's full-sized avatar
🏠
Working from home

Kyohei MORIYAMA sasukeh

🏠
Working from home
View GitHub Profile
@sasukeh
sasukeh / gist:5a59057891259b5488e4b3890bf209a7
Created July 3, 2025 10:31
Project skeleton generator for Copilot Agent integration
#!/usr/bin/env zsh
set -e
# Project skeleton generator for Copilot Agent integration (zsh compatible)
# Creates directories and scaffold files with basic placeholders
# Create directories
for dir in docs docs/adr docs/api docs/diagrams .github src tests; do
mkdir -p "$dir"
done

Utilizing API Management (APIM) for Reliable Integration of the OpenAI API

Created time: May 19, 2025 3:50 PM
Done/WIP: No
Formula: 0 days 0 hours have passed
Last edited time: May 19, 2025 3:50 PM


Introduction

OpenAI APIの信頼性の高い統合におけるAPI Management (APIM) の活用

Created time: May 19, 2025 3:50 PM Done/WIP: No Formula: 0 日 0 時間経過しました Last edited time: May 19, 2025 3:50 PM

はじめに

現代のAI駆動型アプリケーションにおいて、信頼性と堅牢性は非常に重要です。特にOpenAIのAPIのような強力だがレート制限のあるサービスを統合する際には注意が必要です。

// copyright 2024 BotanicFields, Inc.
// BF-018 Rev.3
// JJY Simulator for M5StickC / M5StickC Plus / M5StickC Plus2
//
#include <M5Unified.h>
#include <Ticker.h>
#include <WiFi.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#include "BF_Pcf8563.h"
#include "BF_RtcxNtp.h"
import { AzureFunction, Context, HttpRequest } from "@azure/functions";
import { CosmosClient } from "@azure/cosmos";

// 遅延を発生させる関数
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

// Cosmos DB のクライアント設定
const cosmosClient = new CosmosClient({
    endpoint: "YOUR_COSMOS_DB_ENDPOINT",

1. AzCopy を使ったバックアップ

AzCopy の Table Storage に対応したバージョンAzCopy 7.3 (https://aka.ms/downloadazcopynet) を利用することができます。

  • Table data の ダウンロード(エクスポート)
PS> AzCopy /Source:https://myaccount.table.core.windows.net/myTable/ /Dest:C:\myfolder\ /SourceKey:key
@sasukeh
sasukeh / file0.txt
Created March 6, 2018 11:55
Cloud NativeなIconを丸々ゲットする方法 ref: https://qiita.com/sasukeh/items/ef8f692a1b818f86c40f
git clone git@github.com:cncf/landscape.git
@sasukeh
sasukeh / azCommandSnipet.md
Last active January 15, 2018 14:06
az command snipet

az vm stop --no-wait --ids $(az vm list --query "[].id" -o tsv)

VMのhostname,

az vm list -d -o tsv -g cdsazurepoc2 | awk '{print $7" "$11" "$13}'

こっちのほうがかっこいい

az vm list -d --query "[].{RG:resourceGroup, VMname:name,EIP:publicIps,PIP:privateIps}" -o table |grep -i cds

こっちもいいね

[Unit]
Description = ddns update daemon
After=network.target auditd.service
[Service]
ExecStart = /usr/local/bin/noip2 -c /usr/local/etc/no-ip2.conf
#ExecReload = /usr/bin/pkill -HUP noip2
ExecStop = /usr/bin/pkill noip2
Restart = always
KillMode = process

Best Practices for Azure Redis

Below are a set of best practices that I recommend for most customers. This information is based on my experience helping hundreds of Azure Redis customers investigate various issues.

Configuration and Concepts

  1. Use Standard or Premium Tier for Production systems. The Basic Tier is a single node system with no data replication and no SLA. Also, use at least a C1 cache. C0 caches are really meant for simple dev/test scenarios since they have a shared CPU core, very little memory, are prone to "noisy neighbor", etc.
  2. Remember that Redis is an In-Memory data store. Read this article so that you are aware of scenarios where data loss can occur.
  3. Configure your client library to use a "connect timeout" of at least 10 to 15 seconds, giving the system time to connect even under higher CPU conditions. If your client or server tend to be under high load