Skip to content

Instantly share code, notes, and snippets.

View stevesun21's full-sized avatar

stevesun21

  • Somewhere on the earth
View GitHub Profile
@stevesun21
stevesun21 / gist:2480559
Created April 24, 2012 15:21
Java implemented number wording translator
public class NumberWordingTranslator {
private final static String[] hundredWords={
"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen",
"Twenty", null, null, null, null, null, null, null, null, null,
"Thirty", null, null, null, null, null, null, null, null, null,
"Forty", null, null, null, null, null, null, null, null, null,
"Fifty", null, null, null, null, null, null, null, null, null,
"Sixty", null, null, null, null, null, null, null, null, null,
/**
* Copyright [2014] [SteveSun21]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@stevesun21
stevesun21 / CassandraPaging
Last active November 5, 2018 12:24
Cassandra Java Drive Pagination
import com.datastax.driver.core.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* This is a helper class for implementing a pagination function based on Cassandra Java Driver (http://datastax.github.io/java-driver/)
*
* The solution of skipping rows is that use page state rather than iterator rows one by one.
@stevesun21
stevesun21 / gist:495ab426ef1dfa43625f75f2af648c31
Created February 19, 2017 04:18
Script to install docker on Linode (Ubuntu 16.04 LTS and later)
#!/bin/bash
#Install Docker
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
touch /etc/apt/sources.list.d/docker.list
echo 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' >> /etc/apt/sources.list.d/docker.list
sudo apt-get update