by alexander white ©
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
| cmdAddr, _ := net.ResolveTCPAddr("tcp", n.cfg.Addr) | |
| lcmd, err := net.ListenTCP("tcp", cmdAddr) | |
| if err != nil { | |
| log.Fatalln(err) | |
| } | |
| defer lcmd.Close() | |
| quitChan := make(chan os.Signal, 1) | |
| signal.Notify(quitChan, os.Interrupt, os.Kill, syscall.SIGTERM) | |
| wg := sync.WaitGroup{} | |
| for { |
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
| # Syntax highlighting for Golang with nano editor | |
| wget -O /usr/share/nano/go.nanorc http://go-lang.cat-v.org/text-editors/nano/go.nanorc | |
| # Golang for nano editor | |
| echo '## Go'$'\n''include "/usr/share/nano/go.nanorc"' >> /etc/nanorc |
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 ( | |
| "encoding/json" | |
| "errors" | |
| "net/http" | |
| "github.com/asaskevich/govalidator" | |
| ) |
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 bash | |
| # | |
| # gh-dl-release! It works! | |
| # | |
| # This script downloads an asset from latest or specific Github release of a | |
| # private repo. Feel free to extract more of the variables into command line | |
| # parameters. | |
| # | |
| # PREREQUISITES | |
| # |
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
| ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
| # Don't add passphrase | |
| openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
| cat jwtRS256.key | |
| cat jwtRS256.key.pub |
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 | |
| // http://play.golang.org/p/jZ5pa944O1 <- will not display the colors | |
| import "fmt" | |
| const ( | |
| InfoColor = "\033[1;34m%s\033[0m" | |
| NoticeColor = "\033[1;36m%s\033[0m" | |
| WarningColor = "\033[1;33m%s\033[0m" | |
| ErrorColor = "\033[1;31m%s\033[0m" | |
| DebugColor = "\033[0;36m%s\033[0m" |
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 java.io.FileDescriptor; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| import java.io.PrintStream; | |
| public class HelloWorld{ | |
| private static HelloWorld instance; | |
| public static void main(String[] args){ | |
| instantiateHelloWorldMainClassAndRun(); |
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 HTMLFormatter | |
| def output_report(context) | |
| p %Q{ | |
| <html> | |
| <head> | |
| <title>#{context.title}</title> | |
| </head> | |
| <body> | |
| } | |
| context.text.each do |line| |
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
| /* Use libcurl to POST JSON data. | |
| Usage: PostJSON <name> <value> | |
| curl-library mailing list thread: | |
| 'how do i post json to a https ?' | |
| https://curl.haxx.se/mail/lib-2015-01/0049.html | |
| * Copyright (C) 2015 Jay Satiro <raysatiro@yahoo.com> | |
| https://curl.haxx.se/docs/copyright.html |