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
/** | |
* dependencies { | |
* implementation group: 'com.squareup.okhttp', name: 'okhttp', version: '2.7.5' | |
* implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3' | |
* } | |
*/ | |
import com.fasterxml.jackson.core.JsonFactory; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.squareup.okhttp.OkHttpClient; |
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
docker pull gcc | |
docker run --name gcc -it gcc /bin/bash | |
cd ~ | |
apt update | |
apt-get -y install build-essential flex bison xz-utils wget ca-certificates bc linux-headers-5.10.0-6-common slirp | |
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.12.4.tar.xz | |
tar -xf linux-5.12.4.tar.xz | |
cd linux-5.12.4 | |
make menuconfig ARCH=um |
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
Create your starter hello world app on the website and download the zip archive | |
https://code.quarkus.io/ | |
Check your java version and compile your project: | |
foo@bar:~$ java -version 2>&1 | grep HotSpot | |
foo@bar:~$ ./gradlew quarkusDev | |
Open the dev console: |
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
#!/usr/bin/python | |
import socket | |
import signal # Allow socket destruction on Ctrl+C | |
import sys | |
import time | |
import threading | |
import getopt | |
class WebServer(object): | |
""" |
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
#!/usr/bin/env python3.7 | |
from flask import Flask, Response, request | |
app = Flask(__name__) | |
def printReq(request): | |
print(">>>>") | |
print(request.method, request.path, request.environ.get('SERVER_PROTOCOL', 'HTTP/1.1')) | |
print(request.headers) | |
print(request.data.decode("utf-8")) |
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 | |
port=$1 | |
if [[ -n "$port" ]]; then | |
while true; | |
do | |
{ echo -e "HTTP/1.1 200 OK\r\n$(date)\r\n\r\n<h1>hello world from $(hostname) on $(date)</h1>" | nc -vl $port; } | |
done | |
else | |
echo "Usage: $(basename $0) <port>" | |
fi |
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 | |
file=$1 | |
port=$2 | |
if [[ -n "$file" ]] && [[ -n "$port" ]]; then | |
{ echo -ne "HTTP/1.0 200 OK\nContent-Type: application/octet-stream\nContent-Disposition: inline; filename=\"$1\"\nContent-Length: $(wc -c < $file)\n\n"; cat $file; } | nc -l $port | |
else | |
echo "Usage: $(basename $0) <file> <port>" | |
fi |
NewerOlder