Skip to content

Instantly share code, notes, and snippets.

Avatar

dom farr dominicfarr

View GitHub Profile
@dominicfarr
dominicfarr / index.js
Last active May 30, 2018
Mandrill Webhook Authentication in AWS Lambda function executed from AWS Gateway API
View index.js
'use strict';
const crypto = require("crypto");
const {parse} = require('querystring');
exports.handler = (event, context, callback) => {
const mandrillSignatureHeader = event.headers['X-Mandrill-Signature'];
const rawHTTPBody = event.body; // raw http application/x-www-form-urlencoded
const parsedBody = parse(rawHTTPBody); // parsed into an object
@dominicfarr
dominicfarr / gist:7caf2600ca9cc0a4d9e7995b5a11d6cb
Last active Apr 28, 2017
Delete all your LinkedIn email automatically via browser console (READ COMMENTS BEFORE RUNNING)
View gist:7caf2600ca9cc0a4d9e7995b5a11d6cb
$('.msg-conversation-card__delete').each(function() {$(this).click(); $('[data-control-name="clear_conversation_confirm"]').click();})
@dominicfarr
dominicfarr / gist:10136064
Last active Aug 29, 2015
Resty.ignoreAllCerts() that also implements a HostnameVerifier that ignores hostname
View gist:10136064
public static void ignoreAllCerts() {
TrustManager trm = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
@dominicfarr
dominicfarr / shiro.ini
Created Mar 20, 2014
Shiro ini wiht multiple authentication filters
View shiro.ini
[main]
authc.loginUrl = /web/login.html
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
securityManager.sessionManager = $sessionManager
securityManager.sessionManager.sessionDAO = $sessionDAO
@dominicfarr
dominicfarr / shiro.ini
Last active Oct 13, 2018
example jdbcRealm configured in shiro.ini
View shiro.ini
[main]
ds = com.mysql.jdbc.Driver
ds.serverName = localhost
ds.user = user
ds.password = password
ds.databaseName = db_name
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.dataSource = $ds
jdbcRealm.permissionsLookupEnabled = true
@dominicfarr
dominicfarr / gist:4135248
Created Nov 23, 2012
logstash tutorial errors
View gist:4135248

CONFIG.

input {
  file {
    type => "qmg-app-logs"
    path => [ "/usr/local/logs/*.log", "/usr/local/tomcat/logs/catalina.out"]
  }
}
output {
@dominicfarr
dominicfarr / gist:1925814
Created Feb 27, 2012
Chain google collections
View gist:1925814
public class T
{
protected static final Predicate<String> STRING_PREDICATE = new Predicate<String>()
{
@Override
public boolean apply(final String input)
{
return !Strings.isNullOrEmpty(input);
}
};
You can’t perform that action at this time.