Skip to content

Instantly share code, notes, and snippets.

View viveksyngh's full-sized avatar

Vivek Kumar Singh viveksyngh

View GitHub Profile
package main
import (
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)
@viveksyngh
viveksyngh / example-k8s-yaml.go
Created November 6, 2022 22:28
K8S Object encode/decode using sigs.k8s.io/yaml package
package main
import (
"fmt"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)
@viveksyngh
viveksyngh / example-gopkg-yaml.go
Last active November 6, 2022 21:58
K8S Object encode/decode using gopokgs.in/yaml package
package main
import (
"fmt"
"gopkg.in/yaml.v3"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@viveksyngh
viveksyngh / cowin_schedule_v3.js
Last active May 6, 2021 06:29 — forked from debarko/cowin_schedule_district_wise.js
Get an update on console as soon as a slot opens up in https://selfregistration.cowin.gov.in/ . Login to the website and then run this script on Console.
// This script will alert you whenever some slot opens up on the given date within the given pincodes
// Change the pincodes to your needs as per your city
// Change the dateArr to add your convinent set of dates
// For further update do checkout http://twitter.com/debarko/
// How To setup Video -> https://www.youtube.com/watch?v=3_N5FFegtI4
// Steps to use
// 1. Update Config
@viveksyngh
viveksyngh / log.txt
Last active July 16, 2019 06:55
Astronaut counter function logs
astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Forking fprocess.
astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Query
astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Path /
astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 3
astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:51 stderr: DEBUG:root:Making request to open notify API
@viveksyngh
viveksyngh / stack.yml
Last active July 15, 2019 19:56
Astronaut Counter stack.yml
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
astronaut-counter:
lang: python3
handler: ./astronaut-counter
image: <username>/astronaut-counter:latest
environment:
@viveksyngh
viveksyngh / handler.py
Last active July 15, 2019 19:48
Astronaut Counter Handler
import requests
import random
import logging
import time
logging.basicConfig(level=logging.DEBUG)
def handle(req):
logging.debug("Making request to open notify API")
start = time.time()
@viveksyngh
viveksyngh / bloom-filter-test.py
Created May 20, 2019 19:04
Bloom Filter Test
def test(item):
results = []
for hash_function in hash_functions:
index = hash_function(item) % m
if bit_array[index]:
results.append(True)
else:
results.append(False)
return reduce(lambda a, b : a & b, results)
@viveksyngh
viveksyngh / bloom-filter-add.py
Last active May 20, 2019 19:05
Bloom Filter test operations
def add(item):
for hash_function in hash_functions:
index = hash_function(item) % m
bit_array[index] = True
@viveksyngh
viveksyngh / openfaas-kubernetes.md
Last active November 17, 2018 06:46
OpenFaaS on Kubernetes

Installation of OpenFaaS on kubernetes

You can install OpenFaaS on kubernetes using two ways

1. Using `faas-netes` repository

2. Using Helm 

Installation using faas-netes repository