Skip to content

Instantly share code, notes, and snippets.

@laclefyoshi
laclefyoshi / kafka_cluster.yml
Created October 1, 2020 13:20
docker-compose.yml for Kafka cluster demo
version: '2'
services:
zookeeper:
image: 'docker.io/bitnami/zookeeper:3-debian-10'
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
@laclefyoshi
laclefyoshi / bigquery.sql
Last active April 8, 2020 04:29
テーブル名と同じカラム名のカラムがあるテーブルに対するPostgresqlとBigQueryの結果の差異
WITH a AS ( SELECT 1 AS a, 2 AS b )
SELECT a FROM a ;
-- result::
-- | Row | a.a | a.b |
-- | 1 | 1 | 2 |
-- result (json)::
-- [
-- {
@laclefyoshi
laclefyoshi / fluentd-pubsub-bigquery.txt
Last active June 5, 2017 05:38
FluentdでGCP Cloud PubSubメッセージをBigQueryに投入する際のライブラリ指定
fluent-plugin-bigquery = 0.4.4
google-api-client ~> 0.9.3
fluent-plugin-gcloud-pubsub = 0.0.5
gcloud = 0.6.3
google-api-client ~> 0.8.3
ここで不整合が起こるので、fluent-plugin-bigqueryのバージョンを下げて解決
fluent-plugin-bigquery = 0.2.14
@laclefyoshi
laclefyoshi / gist:ec04576a135e0375608ef561bfb7a9fa
Created May 18, 2017 03:44
JAVA_TOOL_OPTIONSによるJavaプロパティ指定
$ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_80).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import java.util.{TimeZone, Calendar}
import java.util.{TimeZone, Calendar}
scala> TimeZone.getDefault
res0: java.util.TimeZone = sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
@laclefyoshi
laclefyoshi / concat_gzip.txt
Created January 27, 2017 07:14
concat multiple gzip
$ cat <<EOF > 123.txt
> 1
> 2
> 3
> EOF
$ gzip 123.txt
$ cat 123.txt.gz 123.txt.gz > 123123.txt.gz
$ gunzip -c 123123.txt.gz
1
2
@laclefyoshi
laclefyoshi / mqtt_sub.py
Created October 17, 2015 13:17
MQTTブローカからのメッセージを表示
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import paho.mqtt.client as mqtt_client
topic = "MESHBLU_ACTION_UUID"
def on_connect(client, userdata, flags, rc):
print("connected with result code" + str(rc))
client.subscribe(topic)
@laclefyoshi
laclefyoshi / esp8266_mqtt_pub.ino
Last active October 17, 2015 13:18
ESP8266でMQTTブローカを経由しmyThingsにメッセージを投げる
#include <ESP8266WiFi.h>
#include <DHT.h>
#include <PubSubClient.h>
#include <aJSON.h>
#define DHTPIN 4
#define DHTTYPE DHT11
const char* ssid = "WIFI_SSID";
const char* password = "WIFI_PASS";
@laclefyoshi
laclefyoshi / esp8266_mqtt_sub.ino
Last active October 17, 2015 13:18
ESP8266でMQTTブローカを経由したmyThingsメッセージを受け取る
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <aJSON.h>
const char* ssid = "WIFI_SSID";
const char* password = "WIFI_PASS";
const char* mqtt_server = "MESHBLU";
const char* mqtt_clientid = "esp8266";
const char* mqtt_topic = "MESHBLU_ACTION_UUID";
@laclefyoshi
laclefyoshi / langtool-popup.el
Created September 12, 2015 11:33
langtool.elをpopup.elに対応
(defun popup-current-langtool-error ()
(interactive)
(let ((msgs (langtool--current-error-messages)))
(if (null msgs)
(popup-tip "No errors")
(let ((msg (split-string (car msgs) "\n")))
(popup-tip (join "\n" (reverse (nthcdr 2 (reverse msg)))))))))
(global-set-key "\C-ce" 'popup-current-langtool-error)