Skip to content

Instantly share code, notes, and snippets.

View Cameron-C-Chapman's full-sized avatar

Cameron Chapman Cameron-C-Chapman

View GitHub Profile
@Cameron-C-Chapman
Cameron-C-Chapman / install-oracle-java
Created January 26, 2014 20:00
Install Oracle JDK on Ununtu
# Installing Oracle (Sun) JDK on Ubuntu
# Before you install it, remove OpenJDK, if you have it installed:
sudo apt-get purge openjdk*
# To install Java 8/7/6, do this:
# Add the PPA:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
@Cameron-C-Chapman
Cameron-C-Chapman / ubuntu_help
Last active August 29, 2015 13:56
Helpful Ubuntu Commands
# check what ports are in use
sudo netstat -ntlp | grep LISTEN
# find the process id of a program
ps aux | grep -i “name of your desired program”
# and kill it
sudo kill -9 process_id
@Cameron-C-Chapman
Cameron-C-Chapman / trusty_tahr_setup.sh
Last active August 29, 2015 14:02
My running log of what I've done to my fresh Ubuntu 14.04 Trusty Tahr installation.
# This can be ran as a standalone script but really it is just a reference of things I've done with a fresh install in case I want or need to install Ubuntu on another machine.
##############################################################################################################################
# Tips from the following URL: http://howtoubuntu.org/things-to-do-after-installing-ubuntu-14-04-trusty-tahr
# ***Note: First you will need to enable partner repositories in the Software & Updates GUI.***
echo "Downloading GetDeb and PlayDeb....." &&
wget http://archive.getdeb.net/install_deb/getdeb-repository_0.1-1~getdeb1_all.deb http://archive.getdeb.net/install_deb/playdeb_0.3-1~getdeb1_all.deb &&
@Cameron-C-Chapman
Cameron-C-Chapman / windows_7_setup.ps1
Last active August 29, 2015 14:02
A running log of packages I added to my fresh Windows 7 install.
# This is not designed to be a script that is ran, it's just a log of what I did in case I need a fresh install again.
# Chocolatey packages
cinst Sudo
cinst avgantivirusfree
cinst GoogleChrome
cinst Firefox
cinst ccleaner
cinst flashplayeractivex
cinst flashplayerplugin
@Cameron-C-Chapman
Cameron-C-Chapman / AuthenticationFailureHandlerImpl.java
Last active February 22, 2016 18:33
Spring Security custom AuthenticationFailureHandler
package package.name;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.AuthenticationException;
@Cameron-C-Chapman
Cameron-C-Chapman / AccessDeniedHandlerImpl.java
Created February 22, 2016 18:28
Spring Security custom AccessDeniedHandler
package package.name;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.AccessDeniedException;
@Cameron-C-Chapman
Cameron-C-Chapman / LdapSecurityConfig.java
Last active October 10, 2016 20:10
Spring Security LDAP Config
package package.name;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
@Cameron-C-Chapman
Cameron-C-Chapman / WebInitializer.java
Last active February 23, 2016 22:49
SpringBootServletInitializer to set spring profile through tomcat system argument (system property) when deploying as war
package package.name;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.apache.commons.lang.StringUtils;
// auto detected by SpringServletContainerInitializer, which itself auto detected by Servlet 3.0 container
public class WebInitializer extends SpringBootServletInitializer {
@Cameron-C-Chapman
Cameron-C-Chapman / SpringBootDependencyPomSnippet.xml
Created March 11, 2016 15:20
pom entry for including spring boot dependencies when you need to use something else as the parent pom
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.3.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@Cameron-C-Chapman
Cameron-C-Chapman / LICENSE
Last active March 22, 2016 18:28 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: