Skip to content

Instantly share code, notes, and snippets.

View Deviad's full-sized avatar

Davide P. Deviad

View GitHub Profile
@Deviad
Deviad / build.gradle
Created March 26, 2020 11:54
How can I get a fatjar?
import com.moowork.gradle.node.yarn.YarnTask
/*
* This file was generated by the Gradle 'init' task.
*/
buildscript {
repositories {
mavenCentral()
jcenter()
@Deviad
Deviad / Send multiple comands to docker
Last active April 14, 2019 21:58
Send multiple comands to docker
TEMP_VAR=$(cat <<'END_HEREDOC'
export VAR1="something"
export VAR2="something"
END_HEREDOC
)
bash -c "${TEMP_VAR}"
@Deviad
Deviad / BitCalculator.java
Last active January 30, 2019 00:43
BitSum
package com.davide;
/*
# funzione sommabit: effettua somme di bit ricorsivamente. Vuole in input: il primo numero da sommare, il secondo numero da sommare, il riporto al passo precedente e la posizione a cui stiamo sommando
def sommabit(a, b, riportoprecedente, posizione):
if posizione == 0:
s = (not (a) and b) or (a and not (b))
r = a and b
@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 "$@"
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 / 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}
@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 / 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 / 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 / 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/