Skip to content

Instantly share code, notes, and snippets.

Avatar

Satoshi Hikida reddikih

View GitHub Profile
View GsonSample.java
package dummy.json;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.Objects;
View SumInteger.java
package dummy;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.io.TextIO;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.ValueProvider;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.MapElements;
View combination.py
#!/usr/bin/env python3
# coding:utf-8
import sys
def combi(n, r):
assert r >= 0, 'r must be larger than zero'
if n < r:
return 0
if r == 0:
View gist:705ec037ec964fbc88a723d02dc559e4
## Schema Question
### Example Schema
Assuming blog service.
```
CREATE TABLE tag (
id INT PRIMARY KEY,
value VARCHAR(32)
@reddikih
reddikih / BigDecimalTest.java
Created Jun 14, 2018
BigDecimal Usage Sample
View BigDecimalTest.java
import java.math.BigDecimal;
import java.math.RoundingMode;
public class BigDecimalTest {
public static void main(String ... args) {
BigDecimalTest app = new BigDecimalTest();
app.test();
}
@reddikih
reddikih / Java8TimeLibraryTest.java
Created May 2, 2018
Sample of Java8 time library
View Java8TimeLibraryTest.java
package com.orb.framework;
import static java.time.format.DateTimeFormatter.ofPattern;
import static org.junit.Assert.fail;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
View get-all-id.py
#!/usr/bin/env python
# Usage:
# 1. install pip
#
# curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py";python get-pip.py
#
# 2. install cassandra driver via pip
#
# pip install cassandra-driver
#
@reddikih
reddikih / fio-check.sh
Last active Dec 4, 2017
fio check script
View fio-check.sh
#!/bin/sh
NAME=
IODEPTH="1 4 8 16 32 64 128 256"
RUNTIME=60
FILENAME_RANDREAD="/dev/sdb"
FILENAME_RANDRW="/mnt/resource/dummy"
FILENAME_SEQWRITE="/mnt/resource/dummy_write"
View CassandraSample.java
import static java.lang.String.format;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
import com.datastax.driver.core.policies.DefaultRetryPolicy;
import com.datastax.driver.core.policies.TokenAwarePolicy;
View fio-random-read
[random-read]
ioengine=libaio
iodepth=1400
rw=randread
direct=0
numjobs=1
blocksize=4096
;size=33%
;filename=/dev/sdb
iodepth_batch=1400