This is the gist version of my blog post Quick Dockerfile for Python Poetry Projects.
I hope you find it useful.
This is the gist version of my blog post Quick Dockerfile for Python Poetry Projects.
I hope you find it useful.
Flink has a deadlock case and can be caused by the combination of Flink's backpressure mechanism with iterations (more likely when there is heavy feedback load).
There is a proposal to resolve this issue, but it seems to be abondoned.
The walkaround, suggested by Gábor Hermann, is to throttle messages into the iteration.
Here is my implementation.
FROM golang:buster as golang | |
RUN apt-get update && \ | |
DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
ca-certificates \ | |
tzdata \ | |
build-essential \ | |
tar \ | |
bash | |
WORKDIR /app | |
COPY . . |
func firstNUTF8AtMost(s string, n int) string { | |
i := 0 | |
for j := range s { | |
if i >= n { | |
return s[:j] | |
} | |
i++ | |
} | |
return s | |
} |
package main | |
import ( | |
"flag" | |
"fmt" | |
"net" | |
"net/http" | |
) | |
var ( |
// source: https://stackoverflow.com/questions/41240761/check-if-ip-address-is-in-private-network-space | |
var privateIPBlocks []*net.IPNet | |
func init() { | |
for _, cidr := range []string{ | |
"127.0.0.0/8", // IPv4 loopback | |
"10.0.0.0/8", // RFC1918 | |
"172.16.0.0/12", // RFC1918 | |
"192.168.0.0/16", // RFC1918 | |
"169.254.0.0/16", // RFC3927 link-local |
const CompressionPlugin = require("compression-webpack-plugin"); | |
const fileToCompressRegex = /\.(js|css|htm|html|svg|png|txt|json|wasm)$/ | |
const productionMode = process.env.NODE_ENV === 'production' | |
let plugins = [] | |
if (productionMode) { | |
plugins.push(new CompressionPlugin({ | |
filename: '[path][base].br[query]', | |
algorithm: 'brotliCompress', | |
test: fileToCompressRegex, |
// source: https://www.reddit.com/r/golang/comments/5ia523/idiomatic_way_to_remove_duplicates_in_a_slice/db6qa2e/ | |
func SliceUniqMap(s []int) []int { | |
seen := make(map[int]struct{}, len(s)) | |
j := 0 | |
for _, v := range s { | |
if _, ok := seen[v]; ok { | |
continue | |
} | |
seen[v] = struct{}{} | |
s[j] = v |
function isTouchDevice() { | |
return 'ontouchstart' in window | |
} |
# unique line | |
awk '{!seen[$0]++};END{for(i in seen) if(seen[i]==1)print i}' file | |
# second column of a csv, with white spaces and quotes stripped | |
awk -F',' '{gsub(/[ "]/, "", $0);print $2}' some.csv > dest.txt |