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 / gist:790835
Created January 22, 2011 03:44
DNS server like dnsmasq with Arduino and EthernetShield
// -*- mode: c++ -*-
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2011/01/21
**/
#include <SPI.h>
#include <Ethernet.h>
@laclefyoshi
laclefyoshi / gist:769513
Created January 7, 2011 14:32
DNS server with Arduino and EthernetShield
// -*- mode: c++ -*-
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2011/01/12
**/
#include <SPI.h>
@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 / gist:834832
Created February 19, 2011 04:51
R and rjson
library("rjson")
# use rjson
map_data <- fromJSON(paste(readLines("http://maps.google.com/maps/api/elevation/json?path=43.0,141.4|26.2,127.7&samples=500&sensor=false"), collapse=""))
# get a data from Google Elevation API
# convert JSON data into R object using fromJSON()
# toJSON(): convert R object into JSON data
elevation_data <- lapply(map_data$result, function(x){x$elevation})
@laclefyoshi
laclefyoshi / gist:744925
Created December 17, 2010 13:26
Arduino code for posting messages to im.kayac.com
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2010/12/03
**/
#include <SPI.h>
#include <Ethernet.h>
#include <string.h>
@laclefyoshi
laclefyoshi / gist:8627542
Created January 26, 2014 02:46
Mac voices
$ say -v \?
Agnes en_US # Isn't it nice to have a computer that will talk to you?
Albert en_US # I have a frog in my throat. No, I mean a real frog!
Alex en_US # Most people recognize me by my voice.
Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh en_US # Do not pull the wool over my eyes.
Bells en_US # Time flies when you are having fun.
Boing en_US # Spring has sprung, fall has fell, winter's here and it's colder than usual.
Bruce en_US # I sure like being inside this fancy computer
Bubbles en_US # Pull the plug! I'm drowning!