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
@guillaumegarcia13
guillaumegarcia13 / sample.html
Created September 4, 2017 15:53
Angular 4 ng-template & ng-container with parameters
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
@jpukg
jpukg / WindowsExeFile.java
Created September 23, 2017 17:30 — forked from rponte/WindowsExeFile.java
Executing Windows exe file with Java using ProcessBuilder.
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
public class WindowsExeFile {
private final File file;
public WindowsExeFile(String rawPath) {
this.file = convertToFile(rawPath);
@jpukg
jpukg / SpringGuavaCache.java
Created February 19, 2018 16:48 — forked from abhin4v/SpringGuavaCache.java
An implementation of the Spring Cache interface on top of Google Guava cache
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheBuilderSpec;
@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 * *(..))
@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 / 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 / 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 / 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;
}
## 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",