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 / postgres_queries_and_commands.sql
Created January 31, 2018 19:27 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@Cameron-C-Chapman
Cameron-C-Chapman / pom.xml
Created March 22, 2017 17:34 — forked from rodrik/pom.xml
Sample pom.xml file to enable spring-boot on WAS 8.5.5 running jdk1.6
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.rodrik</groupId>
<artifactId>spring-boot-was</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<java.version>1.6</java.version>
</properties>
@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:
@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 / 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 / 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 / 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 / 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 / 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 / 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 &&