Skip to content

Instantly share code, notes, and snippets.

View kazusato's full-sized avatar

Kazuhiko Sato kazusato

View GitHub Profile
@kazusato
kazusato / AzureDevOpsGitPAT.md
Created January 11, 2020 10:46
Azure DevOps Git Repo Personal Access Token Authentication
@kazusato
kazusato / squid.conf
Last active January 9, 2020 21:54
Enable squid to use multiple IP addesses
http_port 3128
acl group_a myip 10.0.2.101/32
acl group_o myip 10.0.2.102/32
tcp_outgoing_address 10.0.2.101 group_a
tcp_outgoing_address 10.0.2.102 group_o
acl localnet src 10.0.0.0/8
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl SSL_ports port 443
@kazusato
kazusato / JsonUtil.kt
Created September 29, 2019 04:31
Utility to generate array expression using Java API for JSON Processing
package kazusato.util
import javax.json.Json
object JsonUtil {
fun toJsonArray(stringList: List<String>): String {
val arrayBuilder = Json.createArrayBuilder()
stringList.forEach { str ->
arrayBuilder.add(str)
@kazusato
kazusato / PgFetchSize.kt
Created September 5, 2019 21:27
PostgreSQLにJDBC接続してfetchSizeを指定してselectするサンプル
package kazusato.dbwork
import java.sql.DriverManager
/**
* This program may be tested with -Xms48m -Xmx48m.
* If fetchSize is not successfully enabled, OutOfMemoryError will occur.
*/
fun main() {
DriverManager.getConnection("jdbc:postgresql://localhost/mydb", "myuser", "mypassword").use { pgConn ->
@kazusato
kazusato / elasticsearch_reading_notes_p102_2.md
Created July 30, 2019 19:47
Elasticsearch実践ガイドメモ_p102_2

Operation 3-26「ドキュメントの登録の例」で、

$ curl -XPOST 'http://localhost:9200/accesslog-2017.11.10/accesslog_type/' ...

としている。

ドキュメントタイプは指定できなくなったことから、

$ curl -XPOST 'http://localhost:9200/flight-20190731' ...
@kazusato
kazusato / elasticsearch_reading_notes_p102.md
Last active July 30, 2019 19:32
Elasticsearch実践ガイドメモ_p102

インデックステンプレートの定義

インデックス定義自体でも同様のはず。

Operation 3-25で、インデックステンプレートを、

...
"mappings": {
  "accesslog_type": {
    "properties": {
      ...
@kazusato
kazusato / start.js
Created July 1, 2019 23:03
d3 with jsdom
/*
* npm install -s d3
* npm install -s jsdom
* node start.js > work.svg
* chrome work.svg
*/
const d3 = require("d3")
const jsdom = require("jsdom")
const { JSDOM } = jsdom
@kazusato
kazusato / junit5-gradle.md
Last active September 15, 2019 00:17
JUnit5 Gradle Dependencies

Groovy DSL

testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.2'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.5.2'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.13.2'

Kotlin DSL -- Not updated

@kazusato
kazusato / gist:38e8cdd823ae051f98a8723d842d7329
Created March 29, 2019 18:27
List of list on Cassandra
Collection of collection like list<list<text>> is not allowed on Cassandra.
But collection of "frozen" collection is allowed.
See the following document:
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/collection_type_r.html
@kazusato
kazusato / update-alternatives-gradle.md
Last active March 22, 2019 06:14
Gradleのalternativesでの切り替え(Ubuntu)

登録

update-alternatives --installで指定した優先度の数字が大きいものがデフォルトでは使用される。

$ sudo update-alternatives --install /usr/bin/gradle gradle /opt/gradle-4.8/bin/gradle 1
$ sudo update-alternatives --install /usr/bin/gradle gradle /opt/gradle-5.3/bin/gradle 2