Skip to content

Instantly share code, notes, and snippets.

@danveloper
danveloper / build.gradle
Created Oct 28, 2018
adding ignore-exceptions-ast to Gradle build
View build.gradle
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
maven { url "https://dl.bintray.com/danveloper/maven" }
}
dependencies {
compile 'com.github.danveloper.ast:ignore-exceptions-ast:1.0.0-rc-2'
}
View text.md
  • Create a new folder
  • Create a build.gradle file
  • Inside the build.gradle file, put the following:
buildscript {
  repositories {
    jcenter()
  }
  dependencies {
View ratpack-t2-micro.md

Ratpack "Hello World" on a t2.micro, Ubuntu 14.04, no extra server configuration.

~30,000 req/s

# ./wrk -t4 -c72 -d60s -R35000 http://localhost:5050
Running 1m test @ http://localhost:5050
  4 threads and 72 connections
  Thread calibration: mean lat.: 823.764ms, rate sampling interval: 3041ms
  Thread calibration: mean lat.: 800.518ms, rate sampling interval: 2902ms
View keybase.md

Keybase proof

I hereby claim:

  • I am danveloper on github.
  • I am danveloper (https://keybase.io/danveloper) on keybase.
  • I have a public key whose fingerprint is FE5B 4B85 F69A 746A 4485 0EB6 8878 7076 EB89 3653

To claim this, I am signing this object:

@danveloper
danveloper / 0_ConfigSlurperConfigSource.groovy
Created Jun 27, 2016
Groovy Script Config Source for Ratpack
View 0_ConfigSlurperConfigSource.groovy
package app
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import com.google.common.io.ByteSource
import com.google.common.io.Resources
import ratpack.config.ConfigSource
import ratpack.file.FileSystemBinding
import java.nio.file.Files
@danveloper
danveloper / FibBackoff.groovy
Last active Jun 23, 2016
Fibonacci Backoff Strategy
View FibBackoff.groovy
import groovy.transform.Memoized
class FibBackoff {
int tryNum
void backoff() {
tryNum = fib(tryNum)
sleep(tryNum * 1000)
}
View ratpack-map-and-flatmap.groovy
/**
* The `Promise#map` method is used to retrieve
* a value asynchronously (via a `Promise`) and
* transform it synchronous to a new value.
*/
class MappingSpec extends Specification {
@AutoCleanup
ExecHarness harness = ExecHarness.harness()
View tunings.adoc

Ratpack Production Tunings

# cat /etc/security/limits.conf

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000
@danveloper
danveloper / a.md
Last active Aug 29, 2015
optimization question
View a.md

Optimization Question

Does JavaScript optimize for a function that is defined within the context of another function?

For example, are the following examples canonically represented (in performance terms) after compilation, or is one approach favored optimally over the other?

Inner-function

function sortMyThings() {
View fuck.txt
for i in $(seq 1 1000); do bash -c "time dig @8.8.8.8 redhat.com>/dev/null &"; done 2>&1 | grep "^real" | grep -v "0m0"
You can’t perform that action at this time.