Skip to content

Instantly share code, notes, and snippets.

@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active October 9, 2022 21:57
How Akka maps to EAI Patterns
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
@juddflamm
juddflamm / gist:5391938
Last active July 13, 2018 01:08
Enabling 2 Way SSL Client Service Calls from within Dropwizard. To do so, you need to load your keystore and truststore and configure HttpClient to us them for HTTPS calls. In this case, my keystore and truststore are the same file with the same password. (Thanks to Coda Hale for an initial solution)
//First create the httpClient in Dropwizard's run method as documented
final HttpClient httpClient = new HttpClientBuilder().using(configuration.getHttpClient()).build();
try {
//Create KeyStore obejcts for both the keystore and truststore
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
KeyStore truststore = KeyStore.getInstance(KeyStore.getDefaultType());
//Then load the actual keystore/truststore file(s), they are the same file in my case
keystore.load(new FileInputStream(configuration.getKeyStore()), configuration.getKeyStorePassword().toCharArray());
.fc {
direction: ltr;
text-align: left; }
.fc table {
border-collapse: collapse;
border-spacing: 0; }
.fc .btn {
line-height: 1.2em; }
html .fc {
@shantanusingh
shantanusingh / gist:2272004
Created April 1, 2012 06:33 — forked from bihe/init.d play
init.d script to launch Play framework under Ubuntu
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
@codahale
codahale / pom.xml
Last active April 20, 2024 01:38
Take this and save it as pom.xml in your project directory.
<?xml version="1.0" encoding="UTF-8"?>
<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>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
@rakeshpai
rakeshpai / errorception-loader.html
Created January 11, 2012 14:33
Errorception's async loader
<script>
// <snip>
(function (window, document) {
var loader = function () {
var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
script.src = "http://errorception.com/projects/" + _errs[0] + "/beacon.js";
tag.parentNode.insertBefore(script, tag);
};
// Wait until window.onload before downloading any more code.
@akhawaja
akhawaja / Application.java
Created December 29, 2011 19:59
Play! Framework 1.2.x Pagination (this is a variation and modification of the version found on https://gist.github.com/1379217)
package controllers;
import controllers.Constants;
import play.mvc.Controller;
import utils.PaginationInfo;
import java.util.List;
/**
* Sample controller.
*/
@dgorissen
dgorissen / jquery.bootstrap.confirm.popover.js
Created November 3, 2011 13:15
Confirmation dialog using jQuery and Bootstrap
/*
Copyright (c) 2011 Damien Antipa, http://www.nethead.at/, http://damien.antipa.at
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:
@dav-rob
dav-rob / ElasticSearch Bulk Indexing
Created October 19, 2011 09:52
ElasticSearch Bulk Indexing from JDBC Input
package ****.elasticsearch.index;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;