Skip to content

Instantly share code, notes, and snippets.

View kamatama41's full-sized avatar
😀
Hello

Shinichi Ishimura kamatama41

😀
Hello
View GitHub Profile
@kamatama41
kamatama41 / logger.go
Created January 27, 2021 23:34
zapでログレベル変える
func init() {
conf := zap.NewProductionConfig()
logLevel := zap.InfoLevel
if l, ok := os.LookupEnv("LOG_LEVEL"); ok {
if err := logLevel.UnmarshalText([]byte(l)); err != nil {
panic(err)
}
}
conf.Level = zap.NewAtomicLevelAt(logLevel)
logger, err := conf.Build()
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Spliterator;
import java.util.stream.Stream;
public class ByteArrayStreamInputStream extends InputStream {
@kamatama41
kamatama41 / DateParser.java
Created June 1, 2018 23:26
Please let me know if you have a smarter way 🙇
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateParser {
public static void main(String[] args) {
System.out.println(parse("2018-06-01 12:00:00.111 JST"));
System.out.println(parse("2018-06-01 12:00:00 JST"));
}

Keybase proof

I hereby claim:

  • I am kamatama41 on github.
  • I am kamatama41 (https://keybase.io/kamatama41) on keybase.
  • I have a public key ASBNJ3xdUTa43M9kdoE3-GA-1wRn7nonL1QdSrkyv7flRgo

To claim this, I am signing this object:

@kamatama41
kamatama41 / SSL_Error.md
Last active October 5, 2017 07:23
SSL certificate verify failed error on Ubuntu 14.04
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"

$ apt-cache policy ca-certificates
ca-certificates:
 Installed: 20170717~14.04.1
new Date().format("yyyy-MM-dd", TimeZone.getTimeZone('Asia/Tokyo'))
#!/bin/bash
set -eu
dataset=kamatama_test
table="creation_test"
bq rm -f ${dataset}.${table}
bq mk --schema ts:string,cnt:integer -t ${dataset}.${table}
// trueを返す
return false;
@kamatama41
kamatama41 / やりたいこと.tf
Last active May 18, 2016 03:30
I'd like to do the following foreach syntax at Terraform to reduce code amount...
["http", "https"].each do |protocol|
resource "aws_security_group_rule" "allow_${protocol}" {
security_group_id = "${aws_security_group.foo.id}"
type = "ingress"
from_port = ${protocol == "http" ? 80 : 443}
to_port = ${protocol == "http" ? 80 : 443}
protocol = "${protocol}"
}
end
module RakutenWebService
module Gora
module AreaCodes
ALL=0
HOKKAIDO=1
AOMORI=2
IWATE=3
MIYAGI=4
AKITA=5
YAMAGATA=6