Skip to content

Instantly share code, notes, and snippets.

View TurtleShip's full-sized avatar

Seulgi Kim TurtleShip

View GitHub Profile
@TurtleShip
TurtleShip / Main.java
Created August 23, 2015 23:07
UVa 10765 - Doves and bombs
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;
// UVa 10765 - Doves and bombs
public class Main {
public static void main(String[] args) {
final Scanner scanner = new Scanner(new BufferedInputStream(System.in));
@TurtleShip
TurtleShip / Main.java
Created August 11, 2015 06:18
A solution to Skyline
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/*
UVa 1232 - SKYLINE
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3673
https://uva.onlinejudge.org/external/12/1232.pdf
*/
public void run() {
MetricsData curData = collectMetricsData();
if(isConsoleReporterOn) {
consoleReporter.report(curData.getData());
}
if(isCSVReporterOn) {
csvReporter.report(curData.getData(), elapsedTime);
}
public static void main() {
String whovilleStagingMetrics = "http://whoville-001.sjc1.yammer.com:8081/metrics";
ServerDataCollector whoville_collector = new ServerDataCollector(whovilleStagingMetrics);
whoville_collector.setRateInSec(1L);
String graphite_host = "10.180.1.232";
int graphite_port = 2003;
String rootPrefix = "monitor-staging";
String metricsPrefix = "whoville-001";
whoville_collector.turnGraphiteReporterOn(graphite_host, graphite_port, rootPrefix, metricsPrefix);
whoville_collector.report();
@TurtleShip
TurtleShip / ExampleServerCollector.java
Last active December 19, 2015 10:09
Example usage of ServerCollector
/**
* Assume that there is a core service running at http://core-service-node1.com:8080
* Then metrics data will be available at http://core-service-node1.com:8081?metrics
* ServerDataCollector can pull metrics data at a regular interval, and monitor real-time.
* it can also save the monitored values */
public class PoundieService {
public static void main(String[] args) throws URISyntaxException, InterruptedException {