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 functools | |
def hello(func): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
print("Hello") | |
return func(*args, **kwargs) | |
return wrapper | |
@hello |
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
package main | |
fun main(args: Array<String>) { | |
val service = Service() | |
service.save(3, "Some value") | |
val value: String = service.find(3) | |
println(value) | |
} |
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
object A { | |
override fun equals(other: Any?): Boolean { | |
if (other is B) return true | |
return super.equals(other) | |
} | |
} | |
object B | |
fun check() { |
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
image: docker:latest | |
services: | |
- docker:dind | |
variables: | |
DOCKER_DRIVER: overlay | |
stages: | |
- build | |
- package |
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 debian:9-slim AS builder | |
RUN set -ex && \ | |
apt-get update && apt-get install -y wget unzip && \ | |
wget https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz -nv -O jdk.tar.gz -nv && \ | |
mkdir -p /opt/jdk && \ | |
tar zxvf jdk.tar.gz -C /opt/jdk --strip-components=1 && \ | |
rm jdk.tar.gz && \ | |
rm /opt/jdk/lib/src.zip |
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/bash | |
check_var(){ | |
if [ -z "$1" ]; then | |
>&2 echo "error: missing environmental variable $2. exit" | |
exit 1 | |
fi | |
} | |
check_var "${JAVA_XMS}" "JAVA_XMS" |
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 pebble.* | |
fun main(args: Array<String>) { | |
card("Title", "Hello world!").show() | |
} |
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
@app.route('/stats', methods=['GET']) | |
def metrics(): | |
registry = CollectorRegistry() | |
multiprocess.MultiProcessCollector(registry) | |
return generate_latest(registry), 200 |
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
def worker_exit(server, worker): | |
from prometheus_client import multiprocess | |
multiprocess.mark_process_dead(worker.pid) |
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
@app.route('/stats', methods=['GET']) | |
def metrics(): | |
return generate_latest(registry), 200 |
NewerOlder