Skip to content

Instantly share code, notes, and snippets.

tanaka_733 tanaka-takayoshi

View GitHub Profile
View main_final.go
package main
import (
"fmt"
"github.com/newrelic/go-agent/v3/newrelic"
"math/rand"
"net/http"
"os"
"time"
)
View startup.sh
#!/bin/sh -eu
# 必ず最新バージョンの値を指定する必要あり。最新バージョン以外は https://download.newrelic.com/php_agent/archive/ 以下からダウンロード
curl -L "https://download.newrelic.com/php_agent/release/newrelic-php5-9.7.0.258-linux.tar.gz" -o /tmp/newrelic-php5-9.7.0.258-linux.tar.gz
tar -xvzf /tmp/newrelic-php5-9.7.0.258-linux.tar.gz -C /tmp
NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 /tmp/newrelic-php5-*/newrelic-install install
rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*
# newrelic.ini ファイルを編集。ライセンスキーとアプリ名以外は必要に応じて追加・削除してください
sed -i \
-e 's/"REPLACE_WITH_REAL_KEY"/"YourLicenseKey"/' \
-e 's/newrelic.appname = "PHP Application"/newrelic.appname = "My PHP Lab on Azure"/' \
View monitor.js
var assert = require('assert');
var request = require('request');
var util = require('util');
const requestPromise = util.promisify(request);
var urlsToMonitor = ['https://blog.newrelic.co.jp/', 'https://docs.newrelic.co.jp/'];
var insightKey = $secure.INSIGHTKEY;
var accountId = $secure.ACCOUNTID;
@tanaka-takayoshi
tanaka-takayoshi / Dockerfile.ASPNETFX
Last active Jan 21, 2020
WindowsコンテナのDockerfileサンプルなど (Ignite Tour Tokyo THR3001/Osaka THR30079 セッション参考資料)
View Dockerfile.ASPNETFX
# ASP.NET Web(.NET Framework)のDockerfileサンプル。slnファイルと同じ階層に配置。
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /app
COPY *.sln .
# プロジェクトファイルを格納しているフォルダごとをコピー
COPY HelloWCOW/ ./HelloWCOW/
# ソリューションファイルを指定してMSBuildによりローカルファイルシステムに発行(Publish)する
RUN msbuild HelloWCOW.sln /p:Configuration=Release /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=\output
View CouponModel.cs
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using Serilog;
namespace WebPortal.Pages
{
@tanaka-takayoshi
tanaka-takayoshi / Dockerfile
Last active May 28, 2019
MagicOnionをコンテナ化してNew Relicで監視するためのファイル
View Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
ENV CORECLR_ENABLE_PROFILING=1 \
CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A} \
CORECLR_NEWRELIC_HOME=/usr/local/newrelic-netcore20-agent \
CORECLR_PROFILER_PATH=/usr/local/newrelic-netcore20-agent/libNewRelicProfiler.so
ARG agent_version="8.15.455.0"
RUN curl https://download.newrelic.com/dot_net_agent/latest_release/newrelic-netcore20-agent_${agent_version}_amd64.deb -o newrelic-netcore20-agent_${agent_version}_amd64.deb \
&& dpkg -i newrelic-netcore20-agent_${agent_version}_amd64.deb \
View example.qs
ApplyToEachCA(CNOT(qs[0], _), qs[1..Length(qs)-1]);
#line 135 "/home/tatanaka/Documents/git/Microsoft/QuantumKatas/Superposition/Tasks.qs"
MicrosoftQuantumCanonApplyToEachCA.Apply((MicrosoftQuantumPrimitiveCNOT.Partial(new Func<Qubit, (Qubit,Qubit)>((_arg1) => (qs[0L], _arg1))), qs?.Slice(new Range(1L, (qs.Length - 1L)))));
#line hidden
for (i in 1 .. Length(qs) - 1) {
CNOT(qs[0], qs[i]);
}
@tanaka-takayoshi
tanaka-takayoshi / Program.cs
Created Dec 9, 2018
ClrMD example for .NET Core on Windows
View Program.cs
using System;
using System.Linq;
using Microsoft.Diagnostics.Runtime;
namespace ClrMDExample
{
class Program
{
static void Main(string[] args)
{
@tanaka-takayoshi
tanaka-takayoshi / mssql-rhel-imsagestream.yml
Created Oct 2, 2018
Example template and imagesteam file for Microsoft SQL Server with RHEL container
View mssql-rhel-imsagestream.yml
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: mssql-rhel
spec:
lookupPolicy:
local: false
tags:
- annotations: null
from:
@tanaka-takayoshi
tanaka-takayoshi / generate-azureconf.sh
Last active Aug 5, 2018
Generate azure.conf for OpenShift in Azure Cloud Shell.
View generate-azureconf.sh
#!/bin/bash
# generate-azureconf.sh RESOURCE_GROUP_NAME
RGNAME=$1
if [ -z $RGNAME ]; then
echo "Usage: $0 RESOURCE_GROUP_NAME"
exit 1
fi
You can’t perform that action at this time.