Skip to content

Instantly share code, notes, and snippets.

View cieplak's full-sized avatar

Patrick Cieplak cieplak

  • Stripe
  • San Francisco, Oakland
View GitHub Profile
@fjavieralba
fjavieralba / KafkaLocal.java
Last active March 23, 2021 09:57
Embedding Kafka+Zookeeper for testing purposes. Tested with Apache Kafka 0.8
import java.io.IOException;
import java.util.Properties;
import kafka.server.KafkaConfig;
import kafka.server.KafkaServerStartable;
public class KafkaLocal {
public KafkaServerStartable kafka;
public ZooKeeperLocal zookeeper;
@jjbcarreno
jjbcarreno / ExportSchemaTest.java
Created November 28, 2013 05:19
Spring JPA Schema export without persistence.xml file
package test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-test.xml" })
@rjeczalik
rjeczalik / building-static-nginx.txt
Created October 19, 2013 15:37
Notes on building nginx as a static binary.
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6
@mjallday
mjallday / README.mkd
Created October 8, 2013 21:21
HANGMAN

Make a client

curl http://balanced-hangman.herokuapp.com

Hopefully you'll see something like

{
 "index": "/", 
 "me": "/me", 
@tomjaguarpaw
tomjaguarpaw / lensesForArrows.lhs
Last active June 19, 2018 21:14
Lenses for Arrows describes how the Lens datatype from Control.Lens can be generalise to support arrows.
> {-# LANGUAGE Rank2Types #-}
>
> import Prelude hiding (id)
> import Data.Functor.Constant (Constant(Constant), getConstant)
> import Control.Arrow (Arrow, arr, first, Kleisli(Kleisli), runKleisli, (&&&))
> import Control.Category ((<<<))
> import Control.Lens (sequenceAOf)
> import qualified Control.Lens as L
> import qualified Control.Lens.Internal.Setter as LS
> import Data.Profunctor (Profunctor, rmap)
@plentz
plentz / nginx.conf
Last active June 25, 2025 06:48
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@elaatifi
elaatifi / SO.java
Created August 19, 2013 14:21
Convert a List to a Map using Orika
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.ConfigurableMapper;
public class SO1 {
/**
@elaatifi
elaatifi / AnnotationClassMapBuilder.java
Created March 21, 2013 10:36
Example of a class-map builder supporting custom annotations to configure Orika mapper.
/*
AnnotationClassMapBuilder extends the default class map builder and override byDefault method to lookup for more metadata
*/
public class AnnotationClassMapBuilder<A, B> extends ClassMapBuilder<A, B> {
protected AnnotationClassMapBuilder(Type<A> aType, Type<B> bType, PropertyResolverStrategy propertyResolver,
DefaultFieldMapper[] defaults) {
super(aType, bType, propertyResolver, defaults);
}
@hintjens
hintjens / zcurve-poc.c
Last active May 23, 2016 00:41
zcurve -- CurveCP over ZeroMQ -- proof of concept
// Proof of concept CurveCP handshake over 0MQ.
//
// Demonstrates a confidential, authenticated connection between
// two 0MQ peers (two DEALER sockets in this example). See the
// curvecp.org website for details of the security design.
//
// This is a flat walk-through in code with minimal abstraction.
// The next version of this code will be more packaged.
//
// IMPORTANT NOTE: this code has not been reviewed by security experts
@wnew
wnew / bram_wb.v
Created November 13, 2012 07:34
Parametrised BRAM wishbone bus interface
//============================================================================//
// //
// Parameterize BRAM with wishbone interface //
// //
// Module name: bram_wb //
// Desc: parameterized dual-port bram with a wishbone interface on one //
// port. //
// Date: June 2012 //
// Developer: Wesley New //
// Licence: GNU General Public License ver 3 //