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
############################################################################################## | |
# This helps unblock me on following a long with materials for learning Ansible and Kubernetes | |
# locally, which rely on a VM service. | |
# | |
# I did not want to use VirtualBox, because on Linux it requires tainting the kernel. I also | |
# already have Docker installed and it's said to have better performance/less overhead. | |
# | |
# This Dockerfile will setup an Ubuntu container and configure it to support SSH, which is | |
# required for testing Ansible locally with Vagrant. | |
# |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Debug Serverless Offline", | |
"type": "node", | |
"request": "launch", | |
"cwd": "${workspaceRoot}/backend", | |
"runtimeExecutable": "npm", | |
"runtimeArgs": ["run-script", "debug"] |
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
/* | |
If you try to do `keyof SomeType`, and `SomeType` has an interface of `[key: string]: x` | |
TypeScript will infer that to a union of `string | number` because JavaScript coerces numeric | |
indexes to strings. | |
Example: obj[0] -> obj["0"] | |
This can make it annoying to try to create an interface for interacting with one of these | |
types when we know we only want to accept string values, or that's a rule we want to enforce. | |
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
// Scatter | |
c := make(chan result, 10) | |
for i := 0; i < cap(c); i++ { | |
go func() { | |
val, err := process() | |
c <- result{val, err} | |
}() | |
} | |
// Gather |
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
c := make(chan User, 1) | |
go func() { c <- getUser() }() // async | |
user := <-c // await |
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 nginx:1.19.4-alpine | |
COPY default.conf /etc/nginx/conf.d/ | |
WORKDIR /var/www/html |
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" | |
"net/http" | |
) | |
func IndexHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprint(w, "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
{ | |
// -> Files | |
"files.trimTrailingWhitespace": true, | |
// -> Editor | |
"editor.defaultFormatter": "esbenp.prettier-vscode", | |
"editor.formatOnSave": true, | |
"editor.renderWhitespace": "all", | |
"editor.formatOnPaste": true, | |
"editor.codeActionsOnSave": { |
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
#!/bin/bash | |
source /usr/bin/cprintf.sh | |
########################################################### | |
# Generate a new SSL | |
# @param string $1 domain | |
if [ -n "$1" ]; then | |
domain="$1" |
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
document.querySelectorAll('.copy-text').forEach(function(elem) { | |
elem.addEventListener('click', function() { | |
var copyText = this.getAttribute('data-copyText'); | |
copyToClipboard(copyText); | |
}); | |
}); | |
function copyToClipboard(text) { | |
var selected = false; |
NewerOlder