This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Apache Tomcat Web Application Container | |
| After=network.target | |
| [Service] | |
| Type=forking | |
| Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
| Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid | |
| Environment=CATALINA_HOME=/opt/tomcat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Unit] | |
| Description=H2 Service | |
| [Service] | |
| User=root | |
| WorkingDirectory=/root | |
| ExecStart=/bin/bash /root/h2.sh | |
| SuccessExitStatus=143 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| /usr/bin/java -Xms64m -Xmx128m -cp /root/h2/bin/h2*.jar org.h2.tools.Server -webAllowOthers -tcpAllowOthers -ifNotExists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env groovy | |
| if (!args) { | |
| println 'Usage: stacktraces.groovy <path/to/logfile>' | |
| System.exit 0 | |
| } | |
| class LogFile extends File { | |
| String entryStartPattern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def regex = ~/\G(?:^|,)(?:"([^"]*+)"|([^",]*+))/ | |
| new File('path/to/file.csv').eachLine { line -> | |
| def columns = [] | |
| def matcher = regex.matcher(line) | |
| while (matcher.find()) { | |
| columns << (matcher.group(1) ?: matcher.group(2)) | |
| } | |
| println columns | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def props = [:] | |
| new File('path/to/some.properties').eachLine { line -> | |
| if ((matcher = line =~ /^([^#=].*?)=(.+)$/)) { | |
| props[matcher[0][1]] = matcher[0][2] | |
| } | |
| } | |
| println props |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To live run use online dart console from here http://try.dartlang.org/ | |
| String reverseStringV0(String word) { | |
| List<String> tokens = new List<String>(); | |
| tokens.addAll(word.split('').reversed); | |
| return tokens.join(''); | |
| } | |
| String reverseStringV1(String word) { | |
| if(word.length == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To live run use online dart console from here http://try.dartlang.org/ | |
| List<int> reverseArray0(List<int> items) { | |
| List<int> ritems = new List<int>(); | |
| ritems.addAll(items.reversed); | |
| return ritems; | |
| } | |
| List<int> reverseArray1(List<int> items) { | |
| List<int> ritems = new List<int>(items.length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.InputStream; | |
| import java.net.URL; | |
| import java.util.Scanner; | |
| public class StreamToString { | |
| public static void main(String[] args) throws Exception { | |
| URL url = new URL("http://localhost:8080/learning-java/ping.java"); | |
| InputStream is = url.openStream(); | |
| String s = StreamToString.streamToString(is); |