Skip to content

Instantly share code, notes, and snippets.

danveloper /
Created December 22, 2023 14:16
Translate Llama2-7B-functions output model to OAI JSON spec
from fastapi import FastAPI, Request
import json
import requests
"messages": [
"content": "you are immensely smart function AI",
"role": "system"
danveloper / build.gradle
Created October 28, 2018 11:15
adding ignore-exceptions-ast to Gradle build
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
maven { url "" }
dependencies {
compile 'com.github.danveloper.ast:ignore-exceptions-ast:1.0.0-rc-2'
  • Create a new folder
  • Create a build.gradle file
  • Inside the build.gradle file, put the following:
buildscript {
  repositories {
 dependencies {

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

Keybase proof

I hereby claim:

  • I am danveloper on github.
  • I am 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 / 0_ConfigSlurperConfigSource.groovy
Created June 27, 2016 05:52
Groovy Script Config Source for Ratpack
package app
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import ratpack.config.ConfigSource
import ratpack.file.FileSystemBinding
import java.nio.file.Files
danveloper / FibBackoff.groovy
Last active June 23, 2016 04:38
Fibonacci Backoff Strategy
import groovy.transform.Memoized
class FibBackoff {
int tryNum
void backoff() {
tryNum = fib(tryNum)
sleep(tryNum * 1000)
* 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 {
ExecHarness harness = ExecHarness.harness()

Ratpack Production Tunings

# cat /etc/security/limits.conf

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000
danveloper /
Last active August 29, 2015 14:25
optimization question

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?


function sortMyThings() {