Skip to content

Instantly share code, notes, and snippets.

View antonarhipov's full-sized avatar
💣

Anton Arhipov antonarhipov

💣
View GitHub Profile
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:09
blog-maven-jar-plugin
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:08
blog-maven-deploy-plugin
<plugin>
<version>2.8.2</version>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
@antonarhipov
antonarhipov / App.java
Created August 7, 2017 12:01
Static initializer to start emebdded Jetty
public class App {
static {
new Thread(() -> {
Server server = new Server(8080);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
server.setHandler(context);
try {
@antonarhipov
antonarhipov / pom.xml
Created August 7, 2017 08:58
Embedding Jetty, pom.xml dependencies
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.4.6.v20170531</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
@antonarhipov
antonarhipov / App.java
Last active August 7, 2017 08:56
Running periodic task
package com.zt;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@antonarhipov
antonarhipov / java
Created March 9, 2017 18:53
LineReader
final FileReader in = new FileReader(new File("lines.txt"));
BufferedReader reader = new BufferedReader(in);
final ArrayList<String> strings = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
strings.add(line);
}
@antonarhipov
antonarhipov / gist:2eafe8c066f1f2064d71
Created February 8, 2016 10:04
com.sun packages in JDK
for file in `find . -name *.jar`; do jar -ft $file >> ~/out.txt ; done
grep "com/sun/[a-z]" out.txt | awk -F"/" '{print $1"/"$2"/"$3}' | sort -u
com/sun/accessibility
com/sun/activation
com/sun/applet2
com/sun/awt
com/sun/beans
com/sun/codemodel
com/sun/corba
@antonarhipov
antonarhipov / Dockerfile
Created January 22, 2016 11:36
Dokerfile for Atlassian Jira
from isuper/java-oracle:jdk_8
ENV JRE_HOME=/usr/lib/jvm/java-8-oracle
run curl -Lks https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.0.5-jira-7.0.5.tar.gz -o /root/jira.tar.gz
run /usr/sbin/useradd --create-home --home-dir /usr/local/jira --shell /bin/bash jira
run mkdir -p /opt/jira
run tar zxf /root/jira.tar.gz --strip=1 -C /opt/jira
run mkdir -p /opt/jira-home
run echo "jira.home = /opt/jira-home" > /opt/jira/atlassian-jira/WEB-INF/classes/jira-application.properties
@antonarhipov
antonarhipov / NullPointerExceptionsPuzzle.java
Created November 21, 2015 22:55
NullPointerExceptions puzzle
public class NullPointerExceptionsPuzzle {
public static void main(String[] args) {
try {
throw new NullPointerException("NullPointerException 1");
} catch (NullPointerException e) {
throw new NullPointerException("NullPointerException 2");
} finally {
return;
}
}
" set cursorline
set expandtab
set modelines=0
set shiftwidth=2
set clipboard=unnamed
set synmaxcol=128
set ttyscroll=10
set encoding=utf-8
set tabstop=2
set nowrap