Skip to content

Instantly share code, notes, and snippets.

View Deviad's full-sized avatar

Davide P. Deviad

View GitHub Profile
@Deviad
Deviad / Acl.java
Created September 9, 2017 23:09
AOP implementation of a filter to create an ACL
package com.davidepugliese.springfood.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Deviad
Deviad / WebConfig.java
Created September 9, 2017 23:15
Test with EnableLoadTimeWeaving
package com.davidepugliese.springfood;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
@Deviad
Deviad / Acl.java
Created September 10, 2017 05:44
AOP - Aspect not working
package com.davidepugliese.springfood.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Deviad
Deviad / blabla.txt
Created September 10, 2017 10:38
Error
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java -Drebel.base=/Users/spotted/.jrebel -Drebel.env.ide.plugin.version=7.0.14 -Drebel.env.ide.version=2017.2.2 -Drebel.env.ide.product=IU -Drebel.env.ide=intellij -Drebel.notification.url=http://localhost:17434 -agentpath:/var/folders/74/4fhn54y97kzdntff775fplj40000gn/T/jrebel6-temp/lib/libjrebel64.dylib -Ddebug -XX:TieredStopAtLevel=1 -noverify -Dspring.main.banner-mode=OFF -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=58970 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Applications/IntelliJIDEA.app/Contents/lib/idea_rt.jar=58971:/Applications/IntelliJIDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/
@Deviad
Deviad / Acl.java
Created September 10, 2017 16:00
Still not working
package com.davidepugliese.springfood.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
@Deviad
Deviad / gist:a440186915e3fe01c81e170c44dd60ba
Created September 13, 2017 06:58
Socat Port Forwarding Examples
Example 1
socat TCP4-LISTEN:5010,reuseaddr,fork PROXY:109.185.139.177:www.zerohedge.com:80,proxyport=65103
In our case
ping www.zerohedge.com
@Deviad
Deviad / Role.java
Created September 16, 2017 05:42
Hibernate - Stackoverflow generic error
package com.davidepugliese.springfood.models;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.*;
import java.util.*;
@Deviad
Deviad / shellCommandWrapper.sh
Created October 14, 2017 15:47
You can use this example-script to wrap a more complicated command, useful when you have tons of options you don't remember
#!/usr/bin/env bash
sfolder="~/"
dfolder="/Applications/"
usage() { echo "Usage: $0 [-s <source folder>] [-d <destination folder>]" 1>&2; exit 1; }
while getopts ":s:d:" o; do
case "${o}" in
s)
s=${OPTARG}
import { inject, injectable } from 'inversify';
import { MongoDBClient } from '../utils/mongodb/client';
import { User } from '../models/user';
import TYPES from '../constant/types';
@injectable()
export class GenericService<T extends GenericEntity> {
private mongoClient: MongoDBClient;
constructor(
@Deviad
Deviad / nodew.sh
Created September 11, 2018 03:27
Node Wrapper to use with Webstorm
#!/usr/bin/env zsh
export PATH=$PATH:/usr/local/bin:~/.nvm/versions/node/"$(node -v | grep -o '[^v]'| tr -d '\n')"/bin
node "$@"