Skip to content

Instantly share code, notes, and snippets.

View reetasingh's full-sized avatar
👩‍💻
PR in progress ¯\_(ツ)_/¯

Reeta Singh reetasingh

👩‍💻
PR in progress ¯\_(ツ)_/¯
View GitHub Profile
@reetasingh
reetasingh / kubectlrc
Created September 6, 2020 21:03 — forked from mlsmrc/kubectlrc
Aliases for Kubernetes control cli kubectl - Specific for CKAD certification
alias k='kubectl'
alias kg='k get'
alias kgp='kg pod'
alias kd='k describe'
alias kdp='kd pod'
alias kD='k delete --force --grace-period=0'
alias kDp='kD pod'
alias kc='k create'
@reetasingh
reetasingh / gist:265f05a6643a612733af532421d636b6
Last active November 2, 2020 00:18
CANVAS_TO_SALESFORCE_INTEGRATION
// This class makes an HTTP GET request to canvas API and inserts the data received from canvas API in salesforce
// create a class which can be called on a schedule
global class FinalTCS implements Schedulable, Database.AllowsCallouts{
public void execute(SchedulableContext SC) {
callWebService();
}
@future(callout=true)
public static void callWebService() {
@reetasingh
reetasingh / Python-Makefile
Last active January 4, 2021 20:13
Makefile for python3 project.
# change <repo> with name of your actual repo
test: # run make setup before this
@echo *************Running tests*************; \
source .venv/bin/activate; \
pytest --junitxml htmlcov/codecov-results.xml --cov . --cov-config test/.coveragerc --cov-report html --cov-report xml
lint: # run make setup before this
@echo *************Running lint*************; \
source .venv/bin/activate; \
pylint <repo>/
@reetasingh
reetasingh / envoy_config_for_routing_using_request_header.yaml
Last active March 10, 2023 15:23
envoy - routing request to cluster based on the value of request header
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
@reetasingh
reetasingh / envoy_http_dynamic_forward_proxy.yaml
Created March 22, 2021 20:13
Envoy to operate as an HTTP dynamic forward proxy
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
address: 127.0.0.1
protocol: TCP
port_value: 9901
static_resources:
listeners:
- name: listener_0
@reetasingh
reetasingh / composite_pattern.go
Last active January 3, 2023 23:42
example for composite pattern in go
package main
import (
"fmt"
"os"
)
type IComponent interface {
Show() error
Delete() error
@reetasingh
reetasingh / function_to_be_retried.go
Created January 4, 2023 22:21
Medium - Retry function explanation part 1
type IReader interface {
Read() error
}
type Reader struct {
}
// Read always throws error
func (r Reader) Read() error {
return fmt.Errorf("error in read")
func Retry(ctx context.Context, f RetryFunc, retryAttempts int) error {
var err error
for i := 0; i < retryAttempts; i++ {
select {
case <-ctx.Done():
return ctx.Err()
default:
}
err := f()
if err == nil {
type ReaderRetryDecorator struct {
reader IReader
}
func (d ReaderRetryDecorator) ReadWithRetry(ctx context.Context, retryAttempts int) error {
var err error
for i := 0; i < retryAttempts; i++ {
select {
case <-ctx.Done():
return ctx.Err()
@reetasingh
reetasingh / decorator_same_interface_as_reader.go
Created January 5, 2023 22:11
using retry with decorator and same interface
type ReaderRetryDecorator struct {
retryAttempts int
reader IReader
}
func (d ReaderRetryDecorator) Read() error {
var err error
for i := 0; i < d.retryAttempts; i++ {
err := d.reader.Read()
if err == nil {