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
func CheckStopForumSpam(ip string) error { | |
sfs_endpoint, err := url.Parse("http://api.stopforumspam.org/api") | |
if err != nil { | |
return errors.New("error parsing sfs endpoint") | |
} | |
queryValues := url.Values{} | |
if ip == "" { |
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
// Make new md5 | |
hasher := md5.New() | |
// Make a new file | |
image, err := os.Create(imagefile) | |
if err != nil { | |
err = errors.New("problem creating file") | |
return | |
} |
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
image, err := os.Open(imagefile) | |
if err != nil { | |
err = errors.New("problem opening file") | |
return | |
} | |
defer image.Close() | |
// Check file type | |
bytes := make([]byte, 4) | |
n, _ := image.ReadAt(bytes, 0) |
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
func UploadPosts(file, date, name, comment, url string) (err error) { | |
// Make a new multipart writer with a buffer | |
var b bytes.Buffer | |
w := multipart.NewWriter(&b) | |
// This is just a random form field | |
if err = w.WriteField("name", name); err != nil { | |
return | |
} |
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
func Scrape(address string) (b *bytes.Buffer) { | |
// Create a new goquery document from the address | |
doc, err := goquery.NewDocument(address) | |
if err != nil { | |
log.Fatal(err) | |
} | |
// A buffer for the CSV writer | |
b := &bytes.Buffer{} |
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
package main | |
import ( | |
"bufio" | |
"encoding/xml" | |
"fmt" | |
"os" | |
) | |
func main() { |
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
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
) |
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
func contains(s []string, e string) bool { | |
for _, a := range s { | |
if strings.EqualFold(a, e) { | |
return true | |
} | |
} | |
return false | |
} |
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
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
ext := ".WEBM" |
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
package main | |
import ( | |
"crypto/hmac" | |
"crypto/sha256" | |
"encoding/base64" | |
"encoding/json" | |
"fmt" | |
"time" | |
) |
OlderNewer