# cat /etc/security/limits.conf
* hard nofile 500000
* soft nofile 500000
root hard nofile 500000
root soft nofile 500000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
window.onload = function() { | |
// Must be server-side images; non-origin images will result in a security exception | |
var images = ["img.jpg"]; | |
for (var i=0;i<images.length;i++) { | |
thumbnailify(images[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI, Request | |
import json | |
import requests | |
""" | |
{ | |
"messages": [ | |
{ | |
"content": "you are immensely smart function AI", | |
"role": "system" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.inject.Inject | |
import com.google.inject.Scopes | |
import org.reactivestreams.Publisher | |
import ratpack.exec.ExecController | |
import ratpack.form.Form | |
import ratpack.func.Function | |
import ratpack.groovy.Groovy | |
import ratpack.guice.Guice | |
import ratpack.server.RatpackServer | |
import ratpack.server.ServerConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -iname "*.java" -exec sed s/\;$// {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name='netty', root='http://clinker.netty.io/nexus/content/repositories/snapshots') | |
@Grab('io.ratpack:ratpack-groovy:0.9.13-SNAPSHOT') | |
import ratpack.handling.Handler | |
import ratpack.server.* | |
RatpackServer.of { spec -> spec | |
.config(ServerConfig.noBaseDir()) | |
.handler { | |
{ ctx -> ctx.render "Hello World!" } as Handler | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.ServerSocket | |
def socket = 8281, password = "danrulz" | |
enum Database { | |
INSTANCE; | |
def table = [:] | |
def shortCodeTable = [:] | |
def insert = { String url -> | |
Sequence.INSTANCE.counter++ | |
def id = Sequence.INSTANCE.counter | |
def shortCode = new BigInteger(id).toString(36)+BigInteger.valueOf(Math.round(Math.random()*1000)).toString(36) |
NewerOlder