Skip to content

Instantly share code, notes, and snippets.

View nickspacek's full-sized avatar

Nick Spacek nickspacek

View GitHub Profile
@nickspacek
nickspacek / Ansible Let's Encrypt Nginx setup
Created September 18, 2017 11:55 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
#!/usr/bin/env ruby
require 'scraperwiki'
# Members of the Legislative Assembly of New Brunswick
# If you really want to get the photo url it is available following the url for each MLA.
require 'iconv'
require 'open-uri'
require 'nokogiri'
require 'uri'
@nickspacek
nickspacek / Unicorn.java
Created February 19, 2013 14:16
Omnipresent unicorn game keeper...
import java.util.HashMap;
import java.util.Map;
public class Unicorn {
// The locations of unicorns in our magical, one-dimensional land
private static final int UNICORN_ONE_LOCATION = 4;
private static final int UNICORN_TWO_LOCATION = 10;
// Let's create a game keeper for the magical land to keep track of where all the Unicorns are!
private static final Map<Integer, Unicorn> UNICORN_GAME_KEEPER = new HashMap<Integer, Unicorn>();
@nickspacek
nickspacek / gist:3340059
Created August 13, 2012 12:04
Workaround for Spring Security 3.0.x lack of BeanResolver in EvaluationContext
public class SecuritySpelBeanResolverInjector implements BeanFactoryAware, BeanPostProcessor {
private BeanFactory factory;
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
if (bean instanceof ExpressionBasedPreInvocationAdvice) {
((ExpressionBasedPreInvocationAdvice) bean).setExpressionHandler(new CustomMethodSecurityExpressionHandler());
}
return bean;
@nickspacek
nickspacek / 3D bug.html
Created January 13, 2011 15:23
Sample displaying CSS3 bug that occurs in Chrome when transitioning the opacity on a 3D-enabled element
<!DOCTYPE html>
<html>
<head>
<style>
.parent {
width: 300px;
height: 300px;
margin-bottom: 10px;
position: relative;
-webkit-perspective: 600;
@nickspacek
nickspacek / RescheduleException.java
Created September 28, 2010 13:09
Abstract Quartz Trigger that will retry itself if requested by concrete implementations
package com.lashpoint.twitter.quartz;
public class RescheduleException extends Error {
/**
*
*/
private static final long serialVersionUID = -253876682421574999L;
public RescheduleException(Throwable t) {
super(t);
@nickspacek
nickspacek / View.pm
Created January 6, 2010 15:49 — forked from jshirley/View.pm
package MyApp::View::TT;
use strict;
use parent 'Catalyst::View::TT';
use Scalar::Util qw(blessed);
use DateTime::Format::DateParse;
__PACKAGE__->config(