Skip to content

Instantly share code, notes, and snippets.

@dehora
dehora / swim.md
Last active January 8, 2021 03:33
SWIM protocol resources
@dehora
dehora / batch_207_arcana.md
Last active August 23, 2016 12:39
Batch 207 Arcana

WebDav put the 207 multi-status response code into the 2xx class regardless of per item errors, because for its usecase the top level response class don't matter. Also none of the error classes were a clear winner over 2xx. Even a batch with all failed items gets mapped to a success level code - but what really matters in Dav are the per item codes.

   Although '207' is used as the overall response status code, the
   recipient needs to consult the contents of the multistatus response
   body for further information about the success or failure of the
   method execution.  The response MAY be used in success, partial
   success and also in failure situations.
@dehora
dehora / docker-life-support.txt
Last active February 4, 2016 11:40
Docker life support
# find docker
eval "$(docker-machine env default)"
# bounce docker
docker-machine restart default
# blitz containers
docker rm $(docker ps -a -q)
# blitz images
@dehora
dehora / debug_logging_ddb_local.sh
Last active March 18, 2023 17:42
debug logging for dynamodb local
cd ~/projects/bin/dynamodb
cat > log4j2.xml <<- XML
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="fatal">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
@dehora
dehora / install_protoc_v3.sh
Created July 30, 2015 09:23
install protoc v3
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout v3.0.0-alpha-3.1
brew install automake
./autogen.sh
./configure
make
sudo make install
@dehora
dehora / KafkaTestProducer.sc
Created April 11, 2015 17:07
simple 08 kafka producer in scala
package net.dehora.kafka.scala
import java.util.Properties
import kafka.producer.{KeyedMessage, Producer, ProducerConfig}
object KafkaTestProducer {
def main(args: Array[String]): Unit = {
val producer = createProducer()
git clone https://github.com/apache/samza-hello-samza.git
cd samza-hello-samza
git checkout master
rm -rf deploy/*
bin/grid bootstrap
mvn clean package
rm -rf deploy/samza
tar -xvf target/hello-samza-0.8.0-dist.tar.gz -C deploy/samza
deploy/samza/bin/run-job.sh --config-factory=org.apache.samza.config.factories.PropertiesConfigFactory --config-path=file://$PWD/deploy/samza/config/wikipedia-feed.properties
deploy/samza/bin/run-job.sh --config-factory=org.apache.samza.config.factories.PropertiesConfigFactory --config-path=file://$PWD/deploy/samza/config/wikipedia-parser.properties
@dehora
dehora / SecureModeSignature.java
Created January 15, 2015 13:32
Intercom Secure Mode Signature
package io.intercom.api.secure;
import org.apache.commons.codec.binary.Hex;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
java -XX:+PrintFlagsFinal -version
[Global flags]
    uintx AdaptiveSizeDecrementScaleFactor          = 4               {product}
    uintx AdaptiveSizeMajorGCDecayTimeScale         = 10              {product}
    uintx AdaptiveSizePausePolicy                   = 0               {product}
    uintx AdaptiveSizePolicyCollectionCostMargin    = 50              {product}
    uintx AdaptiveSizePolicyInitializingSteps       = 20              {product}
    uintx AdaptiveSizePolicyOutputInterval          = 0               {product}
    uintx AdaptiveSizePolicyWeight                  = 10              {product}
java -XX:+PrintFlagsFinal -version