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
| #!/usr/bin/env ruby | |
| # DO Kubernetes Config Auto Updater | |
| # Automatically Update your kubeconf using the DigitalOcean api | |
| # | |
| # Get $50 DigitalOcean Credit :: https://m.do.co/c/d755c35183a9 | |
| # | |
| # (c) 2019 Keiran Smith <opensource_at_keiran_dot_scot> | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal |
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
| import ( | |
| "encoding/json" | |
| "encoding/xml" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) |
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 Handle(req []byte) string { | |
| resp, err := http.Get("https://medium.com/feed/@" + string(req)) // Use the 'req' variable to build our feed URL | |
| // Standard Error Handler | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| defer resp.Body.Close() // Defer closing until the Handle function returns | |
| body, _ := ioutil.ReadAll(resp.Body) // Read the response body and ignore errors |
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
| type PostData struct { | |
| Channel struct { | |
| Posts []struct { | |
| Title string `xml:"title"` | |
| Link string `xml:"link"` | |
| Category []string `xml:"category"` | |
| Creator string `xml:"creator"` | |
| PubDate string `xml:"pubDate"` | |
| Updated string `xml:"updated"` | |
| License string `xml:"license"` |
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 Handle(req []byte) string { | |
| // ... | |
| data := &PostData{} // Create and initialise a data variable as a PostData struct | |
| err = xml.Unmarshal(body, data) // Parse the XML into the structure | |
| } |
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 Handle(req []byte) string { | |
| json, _ := json.Marshal(data.Channel.Posts) // Encode our Struct as JSON | |
| return fmt.Sprintf("%s", string(json)) // Return a String to the OpenFaaS Gateway | |
| } |
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
| package function | |
| import ( | |
| "encoding/json" | |
| "encoding/xml" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) |
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
| affix@target:~$ id | |
| uid=1001(affix) gid=1001(affix) groups=1001(affix),999(docker) |
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
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "log" | |
| "github.com/google/gopacket" | |
| "github.com/google/gopacket/pcap" | |
| ) |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Runtime.InteropServices; | |
| using System.Threading; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace hollow | |
| { |