Skip to content

Instantly share code, notes, and snippets.

Thomas Vitale ThomasVitale

Block or report user

Report or block ThomasVitale

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ThomasVitale
ThomasVitale / Application.java
Last active Sep 30, 2018
Spring Data JPA - Basic Configuration
View Application.java
package com.thomasvitale.jpa.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
View Application.java
package com.thomasvitale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.thomasvitale.model.Person;
import com.thomasvitale.repository.PersonRepository;
@ThomasVitale
ThomasVitale / Application.java
Created Apr 17, 2018
Spring Data MongoDB using Java Configuration
View Application.java
package com.thomasvitale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.thomasvitale.model.Person;
import com.thomasvitale.repository.PersonRepository;
@ThomasVitale
ThomasVitale / functions.php
Last active Feb 15, 2018
Function to customise the title of WordPress archive pages
View functions.php
<?php
function thomas_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_post_type_archive() ) {
@ThomasVitale
ThomasVitale / ConnectorConfig.java
Last active May 2, 2019
How to enable HTTPS in a Spring Boot Application
View ConnectorConfig.java
@Configuration
public class ConnectorConfig {
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
@ThomasVitale
ThomasVitale / ApplicationController.java
Last active Mar 3, 2019
Securing a Spring Boot Application with Keycloak
View ApplicationController.java
package com.thomasvitale.keycloak.controller;
import com.thomasvitale.keycloak.repository.BookRepository;
import org.keycloak.KeycloakSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.ServletException;
@ThomasVitale
ThomasVitale / Main.java
Last active Apr 29, 2019
Keycloak Admin REST API for Java
View Main.java
import com.sun.org.apache.regexp.internal.RE;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import java.util.Arrays;
View .gdbinit
set startup-with-shell off
You can’t perform that action at this time.