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() { | |
ch := make(chan int, 2) | |
ch <- 1 | |
ch <- 2 | |
ch <- 3 | |
fmt.Println(<-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" | |
"time" | |
) | |
func fibonacci(n int, c chan int) { | |
x, y := 0, 1 | |
for i := 0; i < n; i++ { |
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" | |
"sync" | |
"time" | |
) | |
// SafeCounter is safe to use concurrently. | |
type SafeCounter 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
package main | |
import ( | |
"fmt" | |
) | |
func appendCategory(a []string, b []string) []string { | |
check := make(map[string]int) | |
d := append(a, b...) |
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
def intreverse(n): | |
a="" | |
while n>0: | |
b=str(n%10) | |
a=a+b | |
n=n//10 | |
return int(a) |
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
[Unit] | |
Description=Prometheus | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
Type=simple | |
ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus.yml | |
[Install] | |
WantedBy=multi-user.target |
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
global: | |
scrape_interval: 15s | |
# By default, scrape targets every 15 seconds. | |
# Attach these labels to any time series or alerts when communicating with | |
# external systems (federation, remote storage, Alertmanager). | |
external_labels: | |
monitor: 'codelab-monitor' | |
# A scrape configuration containing exactly one endpoint to scrape: | |
# Here it's Prometheus itself. | |
scrape_configs: |
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
scrape_configs: | |
- job_name: 'node' | |
static_configs: | |
- targets: ['<TARGET_IP>:9100'] |
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
# Importing the module pyqrcode | |
import pyqrcode | |
# data for the QR code | |
s = input("Enter the data to be put in the QR code: ") | |
# Generate QR code by the help of create function | |
url = pyqrcode.create(s) | |
# name of the geneated file | |
name = input("Enter name for the generated image file: ") | |
filename = name + ".svg" | |
url.svg(filename, scale = 8) |