Skip to content

Instantly share code, notes, and snippets.

View utkarshmani1997's full-sized avatar
🎯
Focusing

Utkarsh Mani Tripathi utkarshmani1997

🎯
Focusing
View GitHub Profile
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, the end point is : %s !", r.URL.Path[1:])
}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: server-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: goserver
apiVersion: v1
kind: Service
metadata:
name: goserver-service
spec:
selector:
app: goserver
type: NodePort
ports:
- port: 80
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: maya-agent
spec:
replicas: 1
template:
metadata:
labels:
name: maya-agent
@utkarshmani1997
utkarshmani1997 / openebs-provisioner.go
Created February 26, 2018 11:22
code with decorator
// logic with decorator
// logging functions are exported from github.com/opentracing/opentracing-go/log
func Objdecorator(f func(key string, obj interface{}) log.Field) func(string, interface{}) log.Field {
return func(key string, obj interface{}) log.Field {
return log.Object(key, obj)
}
}
func Strdecorator(f func(key, val string) log.Field) func(string, string) log.Field {
return func(key, value string) log.Field {
#!/usr/bin/env python
from gi.repository import Notify
import subprocess
from time import sleep, time
from sys import argv
import dbus
def send_notification(title, text):
try:
@utkarshmani1997
utkarshmani1997 / vm-resize-hard-disk.md
Created November 13, 2018 11:56 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@utkarshmani1997
utkarshmani1997 / map.go
Created June 1, 2019 01:24
Idiomatic vs non-idiomatic
package main
import "fmt"
type myMap map[string]string
func (m myMap) contains(key string) (val string, ok bool) {
val, ok = m[key]
return val, ok
}
Portal Details :
- - - - - - - -
IQN : iqn.2016–09.com.openebs.jiva:pvc-5b0c7dc4-df68–11e9-b597–005056bda303
Volume : pvc-5b0c7dc4-df68–11e9-b597–005056bda303
Portal : 10.120.10.10:3260
Size : 150Gi
Controller Status : running,running
Controller Node : node-1
Replica Count : 3
Replica Details :
kind: PodSecurityPolicy
metadata:
name: openebs-nfs-provisioner
spec:
fsGroup:
rule: RunAsAny
allowedCapabilities:
- DAC_READ_SEARCH
- SYS_RESOURCE
runAsUser: