Skip to content

Instantly share code, notes, and snippets.

View saiumesh535's full-sized avatar
🤒
so long

sai umesh saiumesh535

🤒
so long
View GitHub Profile
@saiumesh535
saiumesh535 / configure_credentials.ts
Last active June 20, 2023 11:30
configure AWS temp credentials
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import AWS, { Route53, S3 } from 'aws-sdk';
import { createHmac } from 'crypto';
type ObjectLike = Record<string, unknown> | string | Error | unknown;
export type CognitoAuthToken = {
AuthenticationResult: {
IdToken: string;
};
};
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: <name_of_the_hpa>
namespace: default
spec:
maxReplicas: 1
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: metrics-server
name: metrics-server
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@saiumesh535
saiumesh535 / index.js
Created February 2, 2022 05:08
Get Users in your GitHub Organisation
const axios = require('axios');
async function getMembers() {
try {
const resp = await axios.default.get('https://api.github.com/orgs/<org_name>/members', {
headers: {
'Accept': "application/vnd.github.v3+json",
"Authorization": "Bearer <token>"
}
});
{"lastUpload":"2022-02-01T14:31:59.145Z","extensionVersion":"v3.4.3"}
@saiumesh535
saiumesh535 / go-json.go
Created June 11, 2021 10:46
Golang JSON
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/tidwall/gjson"
)

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@saiumesh535
saiumesh535 / main.go
Last active September 14, 2020 15:12
Go-redis
package main
import (
"bytes"
"fmt"
"log"
"net"
"strconv"
"sync"
)
@saiumesh535
saiumesh535 / react-cli.rs
Created September 1, 2020 13:56
react-cli.rs
use include_dir::{include_dir, Dir};
use std::fs::create_dir_all;
use std::path::Path;
use std::{time, io::prelude::*};
const PROJECT_DIR: Dir = include_dir!("./server");
fn main() {
let now = time::Instant::now();
let start_path = Path::new("temp");
// let's code some emitters
function Emitter(){
this.events = {};
}
export const emtr = new Emitter();
// on function to push events in array