Skip to content

Instantly share code, notes, and snippets.

@sarathsp06
sarathsp06 / newrelic
Created February 13, 2024 08:00
newrelic code generator template
import (
"context"
"github.com/newrelic/go-agent/v3/newrelic"
pb "github.com/shellagilehub/donut-clients/donuts/go"
"github.com/doug-martin/goqu/v9"
)
{{ $decorator := (or .Vars.DecoratorName (printf "%sWithTracing" .Interface.Name)) }}
// {{$decorator}} implements {{.Interface.Type}} interface instrumented with opentracing spans
type {{$decorator}} struct {
@sarathsp06
sarathsp06 / tmux.conf
Last active June 18, 2019 08:21 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
1 .tmux.conf X
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sarathsp06
sarathsp06 / splittoip.go
Created March 26, 2019 22:06
Snapchat IP Problem
package main
import (
"fmt"
"strconv"
)
// memoise this :D
func splitAsIP(s string, count int) []string {
if !isValidIP(s, count) {
@sarathsp06
sarathsp06 / jumpSteps.go
Created March 10, 2019 20:50
Steps jump
package main
import (
"fmt"
)
func getMaxValIdx(arr []int, first, last int) int {
maxVal := arr[last]
maxValIdx := last
for idx, val := range arr[first+1 : last+1] {
@sarathsp06
sarathsp06 / largerSmaller.go
Created March 10, 2019 20:37
Count of sorted matrix diff set [(i,j).. (i2,j2)]
package main
import (
"errors"
"fmt"
)
type SortedMatrix struct {
matrix [][]int
rCount int
@sarathsp06
sarathsp06 / keybase.md
Created January 2, 2019 07:37
keybase.md

Keybase proof

I hereby claim:

  • I am sarathsp06 on github.
  • I am sarathsp06 (https://keybase.io/sarathsp06) on keybase.
  • I have a public key ASB0MGtsuf_nGHdPkSDmJ1tXPa72C19MxIClpYii0G-rlgo

To claim this, I am signing this object:

@sarathsp06
sarathsp06 / ansible_hosts_from_aws.py
Created August 31, 2018 07:25
Ansible hosts files gerneration for AWS EC2 instances
#!/usr/bin/env python
import sys
from boto import ec2
region = 'us-east-1'
region = 'ap-southeast-1'
region = 'ap-south-1'
INSTANCE_STATE_RUNNING = 16
@sarathsp06
sarathsp06 / create_tree.js
Last active August 28, 2018 13:05
Convert a string with dots('.') to a tree structure
var lst = function(array){return array.slice(-1);}
var head = function(array){return array.slice(0,-1);}
function CreateTree(key){
keys = key.split('.')
tags = {}
var last = lst(keys)
var hd = head(keys)
while(hd.length!==0){
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var lst = function(array){return array.slice(-1);}