Skip to content

Instantly share code, notes, and snippets.

View ddossot's full-sized avatar
:shipit:
s̴̝̺̫͖̞͛̑͆̀̽̕ḩ̵͌̀͘í̴̝̰͉̒́̐͗p̶̯͍͎͒̿́̈́̕

David Dossot ddossot

:shipit:
s̴̝̺̫͖̞͛̑͆̀̽̕ḩ̵͌̀͘í̴̝̰͉̒́̐͗p̶̯͍͎͒̿́̈́̕
View GitHub Profile
@jbowes
jbowes / HttpRequestLogger.java
Created July 5, 2011 16:44
CLF style access logger for Netty based HTTP servers
/**
* Copyright (c) 2011 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
@jorgeortiz85
jorgeortiz85 / unsafe.scala
Created August 12, 2011 15:41
The bug from hell
// This code is unsafe to use in a multithreaded environment.
object A {
def foo = "foo"
B.bar
}
object B {
def bar = "bar"
A.foo
@meiwin
meiwin / gist:2779731
Created May 24, 2012 06:00
Configure cxf wsdl2java to generate list setter in Maven
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yourcompany</groupId>
<artifactId>yourartifact</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
@jboner
jboner / latency.txt
Last active June 8, 2024 14:56
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@imsickofmaps
imsickofmaps / gist:4612905
Last active December 11, 2015 14:18
HOW-TO: Set-up, configure and use Riak Search on existing buckets with Python

HOW-TO: Set-up, configure and use Riak Search on existing buckets with Python

1. Enable search on nodes

From Riak docs:

Riak Search is enabled in the app.config file. Simply change the setting to “true” in Riak Search Config section (shown below).

%% Riak Search Config 
@geedew
geedew / vagrant-scp
Last active July 22, 2017 15:16
Copying files to a Vagrant VM from host
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
SERVER=localhost
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} $FILE vagrant@$SERVER:$PATH
@Deraen
Deraen / components.clj
Last active December 15, 2019 08:03
Compojure-api with Component
(ns foobar.components
(:require [com.stuartsierra.component :as component]
[compojure.api.sweet :refer :all]))
(defmethod compojure.api.meta/restructure-param :components
[_ components acc]
(update-in acc [:letks] into [components `(::components ~'+compojure-api-request+)]))
(defn wrap-components [handler components]
(fn [req]
@johnnyopao
johnnyopao / ub-inline-content-lightbox-min.md
Last active December 15, 2022 11:43
Display your Unbounce form or any inline content in a lightbox without creating a new page (Two step opt-in form)

Display your Unbounce form or any inline content in a lightbox without creating a new page. This can be used to create a two step opt-in form

Example page:

http://unbouncepages.com/lightbox-form/

Steps:

  1. Drop in a button (if you haven’t already) which will act as the trigger that opens up your form lightbox. While this button is selected find it’s ID under the ‘advanced’ tag. Take note of this ID.
@timyates
timyates / ReactiveGameOfLife.java
Last active June 15, 2020 13:39
RxJava and Java 8 Game of Life
import rx.Observable;
import rx.functions.Action1;
import rx.subjects.BehaviorSubject;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
@ddossot
ddossot / README.md
Last active August 29, 2015 14:14
EC2 node discovery for Hazelcast

Alternative implementation of TcpIpJoinerOverAWS

This is a workaround for this Hazelcast issue.

To use the alternative TcpIpJoinerOverAWS:

  • Remove hazelcast-cloud from your project's classpath,
  • Add this class in your project or JAR it up if you prefer,
  • Do not configure an accessKey nor a secretKey in Hazelcast's AwsConfig.