Skip to content

Instantly share code, notes, and snippets.

Avatar

Satoshi Hikida reddikih

View GitHub Profile
@reddikih
reddikih / batch-insert.py
Created Aug 5, 2016
Batch insert python script. It is using the python driver provided by Datastax
View batch-insert.py
#!/usr/bin/env python
from cassandra.cluster import Cluster
from cassandra.query import *
from cassandra import *
import hashlib
import sys
KEYSPACE = 'test'
TABLE = 'user'
BATCH_SIZE = 1000
@reddikih
reddikih / progress-in-shell.sh
Last active Aug 17, 2016
The template to display something in progress. and colored message will be displayed when it is finished.
View progress-in-shell.sh
#!/bin/sh
# See: http://www.m-bsys.com/linux/echo-color-1
TIME=10
echo -n "starting server"
while [ $TIME -gt 0 ]
do
echo -n "."
sleep 1
@reddikih
reddikih / log-collection.sh
Created Aug 23, 2016
A simple C* log collect script
View log-collection.sh
#!/bin/sh
endpoints=$1
output=$2
if [ -z $endpoints ] || [ -z $output ];then
echo "Usage: $0 endpoints out_dir"
exit 1
fi
@reddikih
reddikih / convertBytebufferToString.java
Last active Apr 10, 2020
java convert bytebuffer to string
View convertBytebufferToString.java
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
...
/**
Method Usage
ByteBuffer bf = string2ByteBuffer("test", Charset.forName("UTF-8"));
**/
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
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;
@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 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 / 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;
@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();
}