Skip to content

Instantly share code, notes, and snippets.

View rbalman's full-sized avatar

Balman Rawat rbalman

View GitHub Profile
@rbalman
rbalman / main.go
Created July 25, 2023 08:13
Export sonar cloud report in a CSV format
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
@rbalman
rbalman / qattrs.sh
Created August 14, 2020 05:37
Get AWS SQS queue attributes of multiple queues
#!/bin/bash
if [ -z ${AWS_PROFILE} ]
then
echo "AWS_PROFILE is not set"
exit
fi
if [ -z ${AWS_REGION} ]
then
@rbalman
rbalman / Readme.md
Created August 13, 2020 14:45
Sorting Challenge

UseCase

We have a list containing 25 numbers, that we need to sort and figure out the greatest three numbers. However, the catch is that you can only sort 5 numbers in a single operation. So, basically imagine a function that will sort your numbers but can only take in 5 at a time. Using this function we need to be able to sort the 25 numbers to get top 3. Also, make a note of how many times the sorting function is called.

@rbalman
rbalman / cfn-delete.sh
Last active November 23, 2022 05:37
Delete all the CloudFormation stacks with given search-pattern recursively until every stack is deleted. Make sure to provide DELETE_PATTERN, AWS_PROFILE, AWS_REGION mandatory variables. Dependencies: JQ
#!/bin/bash
if [ -z "${DELETE_PATTERN}" ]
then
echo "please set DELETE_PATTERN environment variable with pattern to delete"
exit
fi
if [ -z "${AWS_PROFILE}" ]
then
@rbalman
rbalman / setup.org
Last active April 27, 2019 06:32
created for the ROR training

Ruby on Rails Setup in Windows Machine 💻

Install gitbash

Download ⬇️

Verify 🚥

press Win(key) + R shortcut
@rbalman
rbalman / ResultsTest.org
Last active March 14, 2019 15:44
Test the Org mode

Kopila Api Org

Kopila API

Here are the lists of API that are exposed by this api backed. Document is categorized based on the REST API request type

GET

/users

curl -X GET http://localhost:3000/users
@rbalman
rbalman / alfa.tex
Created January 24, 2019 07:51
latext test
% Created 2019-01-24 Thu 13:31
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
@rbalman
rbalman / factorial.go
Last active January 7, 2019 09:06
go example for factorial
package main
import (
"fmt"
)
func factorial(n uint) uint {
if n < 0 || n > 100 {
@rbalman
rbalman / dump_memcache.rb
Last active August 2, 2019 19:48
Dumping and restoring the memcache key values using telnet & dalli gem
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
require 'csv'
headings = %w(id expires bytes key)
rows = []
@rbalman
rbalman / drawing_competition_at_duckuchap.html
Last active March 3, 2017 05:44
drawing competition roles and responsibilities cloudfactory CSP
<!doctype html>
<html lang="en">
<head>
<title>Drawing Competition for Primary School</title>
<!-- 2017-03-03 Fri 11:29 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Org-mode">
<meta name="author" content="Balman Rawat">