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
@xfire
xfire / MonadTransV2.hs
Created July 13, 2011 18:15
monad transformer stack example, newtype version
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.Reader
import Control.Monad.State
import Control.Monad.Writer
-- our monad transformer stack
-- a reader with an prefix string for the log
-- a state with the current value as integer
-- a writer to log the work done
@hodzanassredin
hodzanassredin / Prolog.hs
Created December 1, 2011 10:59
simple type level predicates in haskell
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
module Prolog (Petja, Vasja, Serg, Father) where
data Petja = Petja
data Vasja = Vasja
data Serg = Serg
class Father a b where
isFather :: a -> b -> ()
isFather x y = ()
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@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 //
@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
@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);
}
@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 {
/**
@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
@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)
@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",