Skip to content

Instantly share code, notes, and snippets.

View envoy-service-a.json
{
"configs": [
{
"@type": "type.googleapis.com/envoy.admin.v2alpha.BootstrapConfigDump",
"bootstrap": {
"node": {
"id": "service-a-sidecar-proxy",
"cluster": "service-a",
"build_version": "7a12f379e47a9f7cf7211c727fe8fc70b6a0a9ab/1.11.2/Clean/RELEASE/BoringSSL"
},
@kencharos
kencharos / envoy-service-a.json
Created Dec 16, 2019
Consul-connect envoy config
View envoy-service-a.json
{
"configs": [
{
"@type": "type.googleapis.com/envoy.admin.v2alpha.BootstrapConfigDump",
"bootstrap": {
"node": {
"id": "service-a-sidecar-proxy",
"cluster": "service-a",
"build_version": "7a12f379e47a9f7cf7211c727fe8fc70b6a0a9ab/1.11.2/Clean/RELEASE/BoringSSL"
},
@kencharos
kencharos / Main.java
Created May 20, 2019
GraalVM native-image encryption memo(set --enable-all-security-services and set path of libsunjce.so)
View Main.java
package sample;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@kencharos
kencharos / index.js
Created Jul 24, 2018
Get Comments from Upsource via JSON RPC API
View index.js
// upsource get comments from JSON RPC API.
// node 8 upper
const request = require("request-promise") // npm i --save request-promise
const fs = require("fs")
const auth = {
user: "admin",
password: "xxxx"
};
const baseUrl = "http://<your upsource host>/~rpc/"
@kencharos
kencharos / groupByProcedure.js
Created Nov 9, 2017
Cosmos DB stored procedure group by example
View groupByProcedure.js
/*
sampele data:
```
{ "id":"1","category":"00", "item":"item1" ,"price":300}
{ "id":"2","category":"00", "item":"item2" ,"price":400}
{ "id":"3","category":"01", "item":"item3" ,"price":500}
{ "id":"4","category":"01", "item":"item4" ,"price":600}
{ "id":"5","category":"02", "item":"item5" ,"price":700}
View alexaCustomSkillOnHookIO.js
'use strict';
/**
* Hook.io にて、 Alexa Skill を実行するサンプルです
*/
/**
* スピーチ内容を作成する関数です。
* 通常、各イベントの処理の最後にbuildResponseと組み合わせて、次のように実行します。
*
@kencharos
kencharos / Comp.java
Created Feb 17, 2017
CompletableFuture sample(with simple error handling)
View Comp.java
package com.example;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Comp {
public static void main(String[] args) {
@kencharos
kencharos / IfAction.java
Created Oct 2, 2015
xecute lanmda statement if value is not null or empty
View IfAction.java
package jp.co.ulsystems.javafx;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
/**
* execute lanmda statement if value is not null or empty
*
* this replace following code
@kencharos
kencharos / StaticResourceHttpServer
Last active Aug 29, 2015
javaによる複数の特定ディレクトリ以下の静的リソースを返すHttpサーバー(やっつけ実装)
View StaticResourceHttpServer
package server;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
View DefaultExample.java
/*
* Java8 デフォルト実装の使用例
*/
package defaultif;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;