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
################ | |
##### Builder | |
FROM rust:1.61.0-slim as builder | |
WORKDIR /usr/src | |
# Create blank project | |
RUN USER=root cargo new medium-rust-dockerize | |
# We want dependencies cached, so copy those first. |
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
enum MyStringEnum { | |
HELLO = 'HELLO_VALUE', | |
WORLD = 'WORLD_VALUE' | |
} | |
const stringEnumKeys = Object.keys(MyStringEnum); | |
const stringEnumValues = Object.values(MyStringEnum); | |
console.log('Keys:'); | |
// Output: [ 'HELLO', 'WORLD' ] |
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
// Create initial buffer | |
const str = "This is a string"; | |
const buffer = Buffer.from(str, "utf-8"); | |
// Convert buffer back to string | |
const strFromBuffer = buffer.toString(); | |
// Output: This is a string | |
console.log(strFromBuffer); |
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
// Original string | |
const str = "This is a string"; | |
// Create the buffer with "utf-8" encoding | |
const buffer = Buffer.from(str, "utf-8"); | |
// Output: <Buffer 54 68 69 73 20 69 73 20 61 20 73 74 72 69 6e 67> | |
console.log(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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: myapp | |
labels: | |
name: myapp | |
spec: | |
selector: | |
matchLabels: | |
name: myapp |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
labels: | |
name: nginx | |
spec: | |
selector: | |
matchLabels: | |
name: nginx |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-cfgmap | |
data: | |
file-from-cfgmap: | | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>From config map</title> |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
labels: | |
name: nginx | |
spec: | |
selector: | |
matchLabels: | |
name: nginx |
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
FROM alpine:3.15.0 | |
CMD ["echo", "Hello Docker!"] |
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 needed modules | |
*/ | |
import ( | |
"github.com/go-playground/webhooks/v6/github" | |
"github.com/gofiber/fiber/v2" | |
"github.com/valyala/fasthttp/fasthttpadaptor" | |
"log" |