Skip to content

Instantly share code, notes, and snippets.

View ken-tune's full-sized avatar

Ken Tune ken-tune

View GitHub Profile
#!/bin/bash
echo "Installing kubectl, AWS Command Line Utility, eksctl and helm in a Centos environment"
echo
# First configure yum to use https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 as a repo"
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
@ken-tune
ken-tune / bitMaskCreationForBlockStorage.java
Created July 9, 2020 17:09
Bit mask required to be used when mapping logical keys into physical keys using Aerospike block storage technique
/**
* Obtain bit mask required to ensure we have on average a specific number of logical objects in each physical object
* @param keySpaceSize - size of key space
* @param objectsPerBlock - average number of objects stored in each physical object
* @return bit mask as a BigInteger
*/
public static BigInteger getBitMask(long keySpaceSize,int objectsPerBlock){
// No of bits required is
// log(keySpaceSize/objectsPerBlock) / log(2)
// as reqd # of keys is keySpaceSize/objectsPerBlock
@ken-tune
ken-tune / getDeviceMetaDataUsingBlocking.java
Created July 9, 2020 16:56
Retrieve logical object from within a physical object stored by Aerospike
public static final int BIT_MASK_SIZE = 25;
public static final BigInteger BIT_MASK = (new BigInteger("2")).pow(BIT_MASK_SIZE).subtract(new BigInteger("1"));
public static final String METADATA_BIN_NAME = "deviceMetaData";
public static final AerospikeClient aeroClient = new AerospikeClient(hostName,aerospikeServicePort);
/**
* Get device meta data from Aerospike having employed 'blocking' technique
* @param deviceIDasUUID - device id
* @return device meta data
*/
@ken-tune
ken-tune / storeDeviceMetaDataUsingBlocking.java
Created July 9, 2020 16:51
How to store logical objects inside physical Aerospike objects to reduce key space size
public static final int BIT_MASK_SIZE = 25;
public static final BigInteger BIT_MASK = (new BigInteger("2")).pow(BIT_MASK_SIZE).subtract(new BigInteger("1"));
public static final String METADATA_BIN_NAME = "deviceMetaData";
public static final AerospikeClient aeroClient = new AerospikeClient(hostName,aerospikeServicePort);
/**
* Store device meta data in Aerospike using 'blocking' technique
* @param deviceIDasUUID - device id
* @param deviceMetaData - metadat
*/