Skip to content

Instantly share code, notes, and snippets.

View abh006's full-sized avatar
💭

Abhinav abh006

💭
View GitHub Profile
@abh006
abh006 / eslintrc.cjs
Created September 16, 2022 14:14
eslintrc.cjs
module.exports = {
env: {
es6: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
@abh006
abh006 / split_json_array.cpp
Created August 24, 2022 20:34
Splits Huge JSON Array into chunked files, with each line a JSON object
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
using std::cout; using std::cerr;
using std::endl; using std::string;
using std::ifstream; using std::vector;
using std::stack;
using std::to_string;
@abh006
abh006 / balanced-pipeline.ts
Last active June 18, 2022 05:59
RxJS pipeline with zero backpressure.
import { map, Subject, tap } from "rxjs";
function getBalancedPipeline<T>(
generator: AsyncGenerator<T, void, void>,
pipeline = new Subject<T>()
) {
pipeline.subscribe({
next: async () => {
const nextInput = await generator.next();
if (!nextInput.done) {
@abh006
abh006 / Steps.md
Created April 29, 2022 18:50
deploy-to-k8s-from-gh-actions

Create a IAM user to be used in the pipeline. (Say a user with usernae: deploy) Assign the following policies to that user:

  • eks:DescribeCluster
  • eks:ListClusters

deploy.yaml

name: Deploy
on:
  push:
@abh006
abh006 / Dockerfile
Created April 25, 2022 13:09
Dockerfile for Node image based on ubuntu
FROM ubuntu:20.04
# Install Node
ENV NODE_VERSION=18.0.0
RUN apt-get update && apt-get install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
@abh006
abh006 / get-branch-name-gh-actions.yaml
Created January 14, 2022 08:59
Get current branch name inside a Github Action
...
# Add this as a step to the job in which the branch name is needed
- name: Set affected branch name
id: vars
run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/*/}
...
# Use this wherever the branch name is needed
${{ steps.vars.outputs.BRANCH_NAME }}
@abh006
abh006 / caprover.yaml
Created January 12, 2022 19:51
Github Action Files | Caprover
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@abh006
abh006 / amazon-ecr.yaml
Last active January 12, 2022 19:50
Github Actions Files - Amazon ECR
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials

Keybase proof

I hereby claim:

  • I am abh006 on github.
  • I am abhinavmanoj (https://keybase.io/abhinavmanoj) on keybase.
  • I have a public key ASAnVjMrOsgx01WztSLyV__441ZzZZg1w5R-2WILDUu7Qwo

To claim this, I am signing this object: