Skip to content

Instantly share code, notes, and snippets.

View kouzouigh's full-sized avatar

Ouzouigh Kamel kouzouigh

View GitHub Profile
@kouzouigh
kouzouigh / gist:5805974
Created June 18, 2013 14:47
Mapping one to many without join table.
class Consultant {
static hasMany = [activities: Activity]
}
class Activity {
static belongsTo = [consultant: Consultant]
}
@kouzouigh
kouzouigh / gist:5956064
Created July 9, 2013 09:41
Telling Gorm do not map domain class
class Filter {
Date startDate
Date endDate
// Do not map this class
static mapWith = "none"
static constraints = {
}
@kouzouigh
kouzouigh / Application.java
Created July 23, 2017 18:38 — forked from serac/Application.java
Configuring RestTemplate for Client TLS in a Spring Boot Application
/*
* See LICENSE for licensing and NOTICE for copyright.
*/
package edu.vt.middleware.app;
import java.io.File;
import java.security.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
@kouzouigh
kouzouigh / bytebuddy.java
Last active September 13, 2017 20:37
Intercept Date Constructor
public static void main(String[] args) throws Exception {
ByteBuddyAgent.install();
new AgentBuilder.Default()
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(AgentBuilder.InitializationStrategy.NoOp.INSTANCE)
.with(AgentBuilder.TypeStrategy.Default.REDEFINE)
.ignore(new AgentBuilder.RawMatcher.ForElementMatchers(nameStartsWith("net.bytebuddy.").or(isSynthetic()), any(), any()))
.with(new AgentBuilder.Listener.Filtering(
new StringMatcher("java.util.Date", StringMatcher.Mode.EQUALS_FULLY),
AgentBuilder.Listener.StreamWriting.toSystemOut()))
@kouzouigh
kouzouigh / setenv.sh
Created January 30, 2018 15:52 — forked from patmandenver/setenv.sh
Tomcat8 setenv.sh
#
# Cutom Environment Variables for Tomcat
#
############################################
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
export PATH=${JAVA_HOME}/bin:${PATH}
############################################
#
# JAVA_OPTS
@kouzouigh
kouzouigh / setenv.sh
Created January 30, 2018 15:52 — forked from patmandenver/setenv.sh
Tomcat8 setenv.sh
#
# Cutom Environment Variables for Tomcat
#
############################################
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
export PATH=${JAVA_HOME}/bin:${PATH}
############################################
#
# JAVA_OPTS
@kouzouigh
kouzouigh / XMLSignature.java
Created April 16, 2018 07:11 — forked from jsbsantos/XMLSignature.java
XMLSignature impl
package ccf.comum.util;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@kouzouigh
kouzouigh / Button.jsx
Last active June 3, 2018 00:01
Simple React Button Component with increment Event Click Handler
class Button extends React.Component {
state = { counter: 0 };
handleClick = () => {
this.setState(prevState => {
return {
counter: prevState.counter + 1
}
})
@kouzouigh
kouzouigh / ParentChildState.js
Created June 3, 2018 00:00
React Parent Child sharing state
class Button extends React.Component {
handleClick = () => {
this.props.onClickFunction(this.props.incrementValue)
}
render() {
return (
<button onClick={this.handleClick}>+{this.props.incrementValue}</button>
)
}
@kouzouigh
kouzouigh / get_keycloak_access_token.sh
Created June 16, 2018 23:34 — forked from adixchen/get_keycloak_access_token.sh
Get Keycloak access token via curl and pretty print it with python
curl \
-d 'client_id=YOUR_KEYCLOAK_CLIENT' \
-d 'username=YOUR_USERNAME' \
-d 'password=YOUR_PASSWORD' \
-d 'grant_type=password' \
'https://YOUR_KEYCLOAK_SERVER_HOST/auth/realms/YOUR_REALM/protocol/openid-connect/token' \
| python -m json.tool