Skip to content

Instantly share code, notes, and snippets.

View souvikhaldar's full-sized avatar
🌴
On vacation

Souvik Haldar souvikhaldar

🌴
On vacation
View GitHub Profile
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['<TARGET_IP>:9100']
[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
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:
package main
import (
"fmt"
)
func appendCategory(a []string, b []string) []string {
check := make(map[string]int)
d := append(a, b...)
@souvikhaldar
souvikhaldar / intreverse.py
Created February 12, 2019 17:37
Function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
def intreverse(n):
a=""
while n>0:
b=str(n%10)
a=a+b
n=n//10
return int(a)
package main
import (
"fmt"
"sync"
"time"
)
// SafeCounter is safe to use concurrently.
type SafeCounter struct {
package main
import "fmt"
func fibonacci(c, quit chan int) {
x, y := 0, 1
for {
select {
case c <- x:
x, y = y, x+y
case <-quit:
package main
import (
"fmt"
"time"
)
func fibonacci(n int, c chan int) {
x, y := 0, 1
for i := 0; i < n; i++ {
package main
import "fmt"
func main() {
ch := make(chan int, 2)
ch <- 1
ch <- 2
ch <- 3
fmt.Println(<-ch)
package main
import (
"fmt"
"time"
)
func say(s string) {
for i := 0; i < 5; i++ {
time.Sleep(100 * time.Millisecond)