This file contains hidden or 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
| 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) |
This file contains hidden or 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 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"] |
This file contains hidden or 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 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"] |
This file contains hidden or 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
| 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"); |
This file contains hidden or 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
| 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))) |
This file contains hidden or 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
| 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()};
This file contains hidden or 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
| var peopleSchema = new mongoose.Schema({ | |
| name: { | |
| type: String, | |
| required: true, | |
| minlength: 3, | |
| maxlength: 25 | |
| }, | |
| age: Number | |
| }); |
This file contains hidden or 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
| 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:')); |
NewerOlder