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
https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/powerpoint-quickstart | |
https://medium.com/@ferrygunawan/controlling-powerpoint-slides-with-alexa-and-websocket-fd3c91c0901b | |
https://www.npmjs.com/package/slideshow |
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 ( | |
"fmt" | |
"net" | |
"strings" | |
) | |
// isValidEmailMX looks up the MX records for the email address and to check if the domain is valid | |
func isValidEmailMX(emailAddress string) (bool, error) { | |
parts := strings.Split(emailAddress, "@") | |
if len(parts) != 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
package crypto | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" | |
"io" | |
) |
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 crypto; | |
import CryptoException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
import java.nio.ByteBuffer; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.security.InvalidAlgorithmParameterException; |
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 trace() string { | |
pc := make([]uintptr, 15) | |
n := runtime.Callers(2, pc) // 2 -> the calling function's frame details | |
frames := runtime.CallersFrames(pc[:n]) | |
if frame, ok := frames.Next(); ok { | |
// frame.File is the full file path | |
return fmt.Sprintf("%s:%d", frame.Function, frame.Line) | |
} | |
return "" | |
} |
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
-- given two tables with a foreign key | |
-- and the requirement to set a field in tableA to the value of the corresponding field in tableB | |
-- in this case setting tableA.someField to tableB.someOtherField where tableA.fk_id = tableB.id | |
-- tableA ( | |
-- id | |
-- someField | |
-- fk_id | |
-- ) |
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 ( | |
"fmt" | |
"strings" | |
"time" | |
) | |
const timeFormat = "2006-01-02 15:04:05" | |
// JSONTime a wrapper for time.Time that unmarshalls with a custom date format | |
type JSONTime struct { |
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
// SubnetContainsIP check if an IP address is part of the subnet given by the CIDR (ie. '192.168.0.0/24') | |
func SubnetContainsIP(CIDR, addr string) (bool, error) { | |
_, ipNet, err := net.ParseCIDR(CIDR) | |
if err != nil { | |
return false, fmt.Errorf("Error parsing CIDR '%s'", CIDR) | |
} | |
host, _, err := net.SplitHostPort(addr) | |
if err != nil { | |
return false, fmt.Errorf("Error parsing address '%s'. %v", addr, err) |
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 "github.com/julienschmidt/httprouter" | |
// usage | |
// router.POST("/path", BasicAuth(someRequestHandler)) | |
// BasicAuth middleware for incoming requests that must include basic authentication | |
func BasicAuth(handler httprouter.Handle) httprouter.Handle { | |
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { | |
log.Printf("Authorizing request from %s", r.RemoteAddr) |
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 debian:stretch | |
LABEL maintainer="First Last <[email protected]>" | |
ARG POSTGRES_VER=9.6 | |
ARG TZ=Australia/Melbourne | |
ARG DEBIAN_FRONTEND=noninteractive | |
# Ensure Timezone is correct | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone |