Skip to content

Instantly share code, notes, and snippets.

func main() {
addr := flag.String("addr", ":4000", "HTTPS network address")
certFile := flag.String("certfile", "cert.pem", "certificate PEM file")
keyFile := flag.String("keyfile", "key.pem", "key PEM file")
flag.Parse()
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(w, req)
@richzw
richzw / Dockerfile
Created March 9, 2022 04:48
DockerTest
FROM alpine:latest
RUN apk add -U libcap netcat-openbsd
RUN apk add --no-cache iptables ip6tables
RUN apk --no-cache add tcpdump
ENTRYPOINT ["sleep", "1h"]
@richzw
richzw / Dockerfile
Created March 9, 2022 04:06
Docker_test
FROM alpine:latest
RUN apk add -U libcap netcat-openbsd
RUN apk add --no-cache iptables ip6tables
RUN apk --no-cache add tcpdump
ENTRYPOINT ["sleep", "1h"]
public static void main(String[] args) throws IOException {
//create scope list with DataFlow's scopes
Set<String> scopeList = new HashSet<>();
scopeList.addAll(DataflowScopes.all());
GoogleCredentials credential = null;
try {
String curDir = Paths.get(".").toAbsolutePath().normalize().toString();
FileInputStream credFile = new FileInputStream(curDir + "/secrete.json");
PCollection<String> lines = pipeline.apply("readDataFromGCS",
TextIO.read().from("gcs path")
.watchForNewFiles(Duration.standardMinutes(2), Watch.Growth.never()));
PCollection<KV<String, Map<String, String>>> filter_event = lines.apply("ParseAndFilterFn", ParDo.of(new ParseAndFilterFn()));
PCollection<KV<String, Map<String, String>>> minute_window_events = filter_event.apply("MinuteFixwindow",
Window.<KV<String, Map<String, String>>>into(FixedWindows.of(Duration.standardMinutes(3)))
.triggering(AfterProcessingTime
.pastFirstElementInPane()
.plusDelayOf(Duration.standardMinutes(2)))
class RedisSink(object):
def __init__(self, host='localhost', port=6379, password=None, field=None):
self._host = host
self._port = port
self._field = field
self._password = password
self._client = None
self._pool = None
def _connect(self):

//file.js

C = require('./C.js')

console.log(typeof C);

module.exports = function() {
    //var c = new C();
	return {c: new C()};
var peopleSchema = new mongoose.Schema({
name: {
type: String,
required: true,
minlength: 3,
maxlength: 25
},
age: Number
});
var mongoose = require('mongoose');
var c = mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
//console.log(c.connection === mongoose.connection);
//var con = mongoose.createConnection('mongodb://localhost/test');
//console.log(con.connection === mongoose.connection);
db.on('error', console.error.bind(console, 'connection error:'));