Skip to content

Instantly share code, notes, and snippets.

View amrfaissal's full-sized avatar
:electron:
Sky's the limit!

amrfaissal

:electron:
Sky's the limit!
View GitHub Profile
@ControllerAdvice
public class NotFoundHandler {
@Value("${spa.default-file}")
String defaultFile;
@ExceptionHandler(NoHandlerFoundException.class)
public ResponseEntity<String> renderDefaultPage() {
try {
File indexFile = ResourceUtils.getFile(defaultFile);
FileInputStream inputStream = new FileInputStream(indexFile);
@kevcodez
kevcodez / CloseableClient.java
Created January 1, 2018 20:22
Autocloseable Jax-RS Client
import java.net.URI;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Configuration;
@kiki67100
kiki67100 / docker-x11.bash
Created December 14, 2017 09:10
Docker macOS X11 display
### Script to install xquartz and set the DISPLAY variable correctly, find the listen port and add current ip to connect to X11.
#skip if you want, install xquartz
brew cask reinstall xquartz
#get ip
IP=$(ifconfig|grep -E inet.*broad|awk '{ print $2; }')
#open XQuartz
open -a XQuartz &
#Go to preference Security check allow network, restart :
read -p "Go to preference Security check allow network and press a key to continue"
@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@kana-ph
kana-ph / guide-amq_zk.md
Last active February 17, 2023 05:47
ActiveMQ on Zookeeper Setup Guide

Setup Diagram

Image grabbed from ElasticCloudApps.com

Ingredients

  • 3 Linux machines with Installed JDK 1.7+
    • Default setup is 3 Replicas
  • Apache ActiveMQ 5.13.4 (stable)
    • Extract to /opt/activemq/apache-activemq-5.13.4 (We call this ACTIVEMQ_HOME from now on)
  • Apache Zookeeper 3.4.8 (stable)
@bitwalker
bitwalker / config.ex
Created July 19, 2016 23:00
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.