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" | |
"math" | |
"os" | |
"strconv" | |
) | |
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
docker run --rm \ | |
--name test-acme \ | |
-v "$(pwd)":/usr/app \ | |
golang:1.18 \ | |
bash -c "cd /usr/app && go test -v ./..." |
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
AWSTemplateFormatVersion: 2010-09-09 | |
Parameters: | |
PoolName: | |
Type: String | |
PoolClientName: | |
Type: string | |
Resources: | |
Pool: |
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
const express = require("express") | |
const sessions = require("express-session") | |
const FileStore = require("session-file-store")(sessions) | |
const app = express() | |
app.use(sessions({ | |
secret: "whatasecret", | |
saveUninitialized: false, | |
resave: false, | |
store: new FileStore({}), |
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 replaceImageInTemplate(filepath string, prefix string, newString string) error { | |
input, err := ioutil.ReadFile(filepath) | |
if err != nil { | |
return err | |
} | |
r, err := regexp.Compile(fmt.Sprintf("(?m)^%s(.*?)$", prefix)) | |
if err != nil { | |
return err | |
} |
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 ReplaceInTemplate(filepath string, origString string, replaceString string) error { | |
input, err := ioutil.ReadFile(filepath) | |
if err != nil { | |
return err | |
} | |
output := bytes.Replace(input, []byte(origString), []byte(replaceString), -1) | |
if err = ioutil.WriteFile(filepath, output, 0666); err != nil { | |
return err |
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 RemoveFiles(dir string) error { | |
d, err := os.Open(dir) | |
if err != nil { | |
return err | |
} | |
defer d.Close() | |
names, err := d.Readdirnames(-1) | |
if err != nil { | |
return err |
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 ( | |
"bytes" | |
"encoding/json" | |
"errors" | |
"flag" | |
"fmt" | |
"net/http" | |
"os" |
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
// SSHClone clones a private GitHub repository using SSH, in the directory passed as parameter | |
func SSHClone(dest string) error { | |
var publicKey *ssh.PublicKeys | |
sshKey, err := ioutil.ReadFile("/Users/youruser/.ssh/id_rsa") | |
if err != nil { | |
return err | |
} | |
publicKey, err = ssh.NewPublicKeys("git", sshKey, "") | |
if err != nil { |
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
class EmailProvider { | |
#config = {} | |
constructor(config) { | |
this.#config = config | |
if (new.target === EmailProvider) { | |
throw new Error('Cannot construct EmailProvider instances directly') | |
} | |
if (this.send === EmailProvider.prototype.send) { |
NewerOlder