Skip to content

Instantly share code, notes, and snippets.

View jpukg's full-sized avatar
🧭
Full Stack Developer (Java, Angular)

Jayaprakash / JP jpukg

🧭
Full Stack Developer (Java, Angular)
  • Brussels, Belgium
View GitHub Profile
@jpukg
jpukg / ApplicationConfig.java
Created November 7, 2020 18:23 — forked from madan712/ApplicationConfig.java
ApplicationConfig.java for Simple spring integration with springboot
package com.javaxp;
import java.io.File;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.channel.DirectChannel;
@Theartbug
Theartbug / java_generics.md
Last active November 1, 2020 16:37
java fundamentals generics

Advanced topics

Functional Interfaces

  • usecase for wildcards
  • lambda expressions have types
  • good for library building
// has ingoing type T and return type R
Function<T, R> -> R apply(T arg)
@toraritte
toraritte / configure-postgres-to-allow-remote-connection.md
Last active September 4, 2023 01:06
Configure PostgreSQL to allow remote connections

Configure PostgreSQL to allow remote connections

NOTE: This post is a personal update to Neeraj Singh's post. [PostgreSQL must also be configured to allow remote connections][1], otherwise the connection request will fail, even if all firewalls rules are correct and PostgreSQL server is listening on the right port.

Steps

Outline

Couldn't create links, but this is a rather long answer so this may helps.

## Batch Create Assertion Duplicate
curl -X "POST" "http://localhost:4000/api/batch/assertions" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Cookie: jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYXJsb3NAYmFkZ2V0cmVlLmNvbSIsImlkIjoyfQ.yL0nNX_l3VtPjgZdVk7-1Q7TD4XF_IiVk2VgwhwoOqs; ueberauth_linkedin_state=INKFNIWeDa6TbzGP9aI/VA==' \
-d $'{
"data": [
{
"issuer_id": "4",
"user_email": "diego@edvolution.io",
"message": "Mensaje",
@jpukg
jpukg / Person1.java
Created December 28, 2018 23:28 — forked from anildigital/Person1.java
Shows how applying SOLID Design principles like Single Responsibility Principle (SRP) leads to many small classes. Furthermore, if you rigorously apply the Interface Segregation Principle (ISP), you'll eventually arrive at the ultimate Role Interface: an interface with a single method.
// Simple Java program
public class Person {
private int age;
private boolean isFemale;
Person(int age, boolean isFemale) {
this.age = age;
this.isFemale = isFemale;
}
@jpukg
jpukg / FreshExpiringLoadingCache.java
Created October 14, 2018 19:40 — forked from kashyapp/FreshExpiringLoadingCache.java
Loading cache that keeps keys fresh until expiry.
import com.yammer.dropwizard.util.Duration;
import com.google.common.cache.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.*;
import static com.google.common.base.Throwables.propagateIfInstanceOf;
public class LocalAppConfigStorage implements AppConfigStorage {
@jpukg
jpukg / ping-test.sh
Created June 18, 2018 11:52 — forked from PHLAK/ping-test.sh
24 hour while loop in bash
#!/bin/bash
## Script start time
START=$(date +%s)
## Total run time
DURRATION=$((60 * 60 * 24))
## Total running time
UPTIME=$(($(date +%s) - $START))
@jpukg
jpukg / simple_args_parsing.sh
Created June 18, 2018 11:50 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@jpukg
jpukg / gist:17af1e8ec3fd5f83c2d3d19d2bc3d572
Created April 13, 2018 21:40 — forked from tsegismont/gist:2960038
Default Transaction Interception for spring @service objects
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="myDS" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:pointcut id="defaultServiceMethodTxPointcut"
expression="execution(!@org.springframework.transaction.annotation.Transactional * *(..))