Skip to content

Instantly share code, notes, and snippets.

View imdurgadas's full-sized avatar

Durgadas Kamath imdurgadas

View GitHub Profile
@imdurgadas
imdurgadas / generateAWSCredentials.sh
Last active May 6, 2023 06:01
Generate .aws/credentials file from SSO temporary credentials.
#!/bin/bash
set -e
# Set the profile name
profile_name=$1
region=ap-south-1
# Run the command to export SSO credentials
sso_export=$(aws-sso-creds export --profile "$profile_name")
@imdurgadas
imdurgadas / TwoWayHashing.js
Created July 8, 2022 15:04 — forked from pujansrt/TwoWayHashing.js
Two way hashing (JS)
const crypto = require('crypto');
const algorithm = 'aes256';
const salt = '900150983cd24fb0d6963f7d28e17f72';
const cryptoEncoding = 'base64';
const cipher = crypto.createCipher(algorithm, salt);
const encryptedText = cipher.update(text, 'utf8', cryptoEncoding) + cipher.final(cryptoEncoding);
@imdurgadas
imdurgadas / kafka-basics.md
Last active December 25, 2021 14:24
Kafka basic commands

Start Zookeeper

zookeeper-server-start.sh config/zookeeper.properties

Start Kafka

kafka-server-start.sh config/server.properties

Kafka topics

  • Create topic : kafka-topics.sh --bootstrap-server localhost:9092 --topic first_topic --create --partitions 3 --replication-factor 1
  • Delete topic : kafka-topics.sh --bootstrap-server localhost:9092 --topic first_topic --delete
#!/bin/bash
echo "This is created by the session create" >> /home/student/session.txt
@imdurgadas
imdurgadas / devcamper_specs.md
Created December 20, 2020 07:17 — forked from bradtraversy/devcamper_specs.md
Specs for Devcamper Udemy course project

DevCamper Backend API Specifications

Create the backend for a bootcamp directory website. The frontend/UI will be created by another team (future course). The html/css template has been created and can be used as a reference for functionality. All of the functionality below needs to be fully implmented in this project.

Bootcamps

  • List all bootcamps in the database
    • Pagination
    • Select specific fields in result
    • Limit number of results
  • Filter by fields
@imdurgadas
imdurgadas / build-publish.sh
Last active November 3, 2018 14:18
Build and Publish
#get-base-image method is mentioned in https://gist.github.com/imdurgadas/755f4f86bc48cd51177413bf877e7869
REGISTRY="docker-org-name"
IMAGE="docker-image-name"
publish() {
local version=$1
local tag="${version}"
for arch in ${ARCHS[*]}; do
@imdurgadas
imdurgadas / make-docker-file.sh
Created November 3, 2018 14:12
Make docker file to support multi platform
ARCHS=(arm s390x amd64 ppc64le)
QEMUARCHS=(arm s390x x86_64 ppc64le)
makeDockerfile() {
local arch=$1
local dockerfile
dockerfile="Dockerfile-${arch}"
@imdurgadas
imdurgadas / get-qemu.sh
Last active November 3, 2018 14:12
Get QEMU
ARCHS=(arm s390x amd64 ppc64le)
QEMUARCHS=(arm s390x x86_64 ppc64le)
QEMUVER="v2.12.0-1"
get-qemu() {
if [[ ! $(find . -name "*qemu-*") ]]; then
echo "Downloading Qemu "
for target_arch in ${QEMUARCHS[*]}; do
if ! curl -OLs "https://github.com/multiarch/qemu-user-static/releases/download/$QEMUVER/x86_64_qemu-${target_arch}-static.tar.gz"; then
echo "Error downloading Qemu"
@imdurgadas
imdurgadas / Jenkinsfile
Created August 8, 2018 09:04 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
@imdurgadas
imdurgadas / graphwkf.py
Created August 24, 2014 10:53
Demonstration of Graphy workflow using TaskFlow framework
import taskflow.engines
from taskflow.patterns import graph_flow as gf
from taskflow.patterns import linear_flow as lf
from taskflow import task
class Executor(task.Task):
def execute(self, greet, name):
return greet + name
flow = gf.Flow('main').add(