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 ( | |
"fmt" | |
"strconv" | |
) | |
func fizzbuzz(num int) string { | |
switch { | |
case num%15 == 0: |
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 ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func fib(ch chan string, number float64) { | |
x, y := 1.0, 1.0 |
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
nodes=$(kubectl get nodes --no-headers | awk '{print $1}') | |
for n in ${nodes[@]}; do | |
pods=$(kubectl get pod -A --field-selector spec.nodeName=$n --no-headers | awk '{print $2}') | |
echo $n = $(echo $pods | wc -w) | |
done |
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
╷ | |
│ Error: Unsupported attribute | |
│ | |
│ on main.tf line 96, in resource "azurerm_route_table" "route_tables": | |
│ 96: address_prefix = each.value.address_prefix | |
│ ├──────────────── | |
│ │ each.value is object with 2 attributes | |
│ | |
│ This object does not have an attribute named "address_prefix". | |
╵ |
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
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: security-context-demo | |
spec: | |
containers: | |
- name: sec-ctx-demo | |
image: busybox:1.28 | |
command: [ "sh", "-c", "sleep 1h" ] | |
securityContext: |
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 ( | |
"fmt" | |
"strings" | |
) | |
func wordFrequency(text string) map[string]int { | |
input := strings.Fields(text) | |
wc := make(map[string]int) |
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 ( | |
"fmt" | |
"golang.org/x/tour/tree" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. |
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 ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("index:", linearSearch([]int{2, 10, 40, 30, 21, 41, 56}, 10)) | |
} |
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 ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
fmt.Println("index", binarySearch([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 8)) | |
} |
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 datetime import datetime | |
start_time = "10:44:09.339931" | |
end_time = "10:44:09.376233" | |
t1 = datetime.strptime(start_time, "%H:%M:%S.%f") | |
print('Start time:', t1.time()) | |
t2 = datetime.strptime(end_time, "%H:%M:%S.%f") | |
print('End time:', t2.time()) |