Skip to content

Instantly share code, notes, and snippets.

View payara-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 6.2023 Resource Definitions//EN" " ">
<!--
Заполнить данные - см.комментарии
-->
<resources>
<!-- имя пула (заменить poolname), например java:app/db_pool-->
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
View payara-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 6.2023 Resource Definitions//EN" " ">
<!--
Заполнить данные - см.комментарии
-->
<resources>
<!-- имя пула (заменить poolname), например java:app/db_pool-->
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
View p0811.kt
fun main() {
//val arr = intArrayOf(1, 2, -5, 7, 9, 0, 15, -4, 9)
//val fiveOfFives = IntArray(5) { 5 }
val n = readln().toInt()
val arr = readArrayFromLine()
val res = minimumsToTheLeft(arr)
printArray(res)
// val max = maxOfArray(arr)
@EugenyB
EugenyB / context.xml
Created August 12, 2022 16:24
context.xml example
View context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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
View 11.java
// Exercise 11: Gather the words into a map, accumulating a count of the
// number of occurrences of each word. Don't worry about upper case and
// lower case. Extra challenge: implement two solutions, one that uses
// groupingBy() and the other that uses toMap().
@Test
public void wordFrequencies() throws IOException {
// Map<String, Long> map = reader.lines()
// .flatMap(s -> Arrays.stream(s.split(REGEXP)))
// .filter(s -> !s.isEmpty())
@EugenyB
EugenyB / settings.xml
Created February 16, 2021 09:33
maven settings for nuos proxy
View settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>10.10.0.105</host>
<port>3128</port>
@EugenyB
EugenyB / pom.xml
Created October 14, 2020 12:35
Maven project - java 11 + lombok + jackson
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>fxjsondemo</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
View gist:8382839f1a6cbebe45a44b16c9c51c7e
From fairest creatures we desire increase,
That thereby beauty's rose might never die,
But as the riper should by time decease,
His tender heir might bear his memory:
But thou contracted to thine own bright eyes,
Feed'st thy light's flame with self-substantial fuel,
Making a famine where abundance lies,
Thy self thy foe, to thy sweet self too cruel:
Thou that art now the world's fresh ornament,
And only herald to the gaudy spring,
View sfml.cpp
#include <SFML/Graphics.hpp>
#include <cmath>
int main()
{
sf::RenderWindow window(sf::VideoMode(400, 400), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
sf::Vertex line[2];
line[0].position = sf::Vector2f(0, 0);
@EugenyB
EugenyB / persistence.xml
Last active March 7, 2020 10:54
persistence.xml for desktop
View persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="MyPU">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/usersdb"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="username"/>