Skip to content

Instantly share code, notes, and snippets.

View KazChe's full-sized avatar

kam chehresa KazChe

View GitHub Profile
@KazChe
KazChe / session_storage_sso_log_collector.js
Created November 21, 2024 00:36
Runs in Chrome devtools console. Reads Session storage by key and periodically collects/prints SSO log data. Useful for troubleshooting access and refresh tokens.
(function pollSSOLogs() {
const sessionKey = '<ADD_KEY_HERE>';
const interval = 1 * 60 * 1000; // adjust - set to 1 minute
let intervalId;
function readSSOLogs() {
try {
const data = sessionStorage.getItem(sessionKey);
if (data) {
console.log(`[${new Date().toISOString()}] SSO Logs:`);
@KazChe
KazChe / session_storage_sso_log_collector.js
Created November 21, 2024 00:35
Runs in Chrome devtools console. Reads Session storage by key and periodically collects/prints SSO log data.
(function pollSSOLogs() {
const sessionKey = '<ADD_KEY_HERE>';
const interval = 1 * 60 * 1000; // adjust - set to 1 minute
let intervalId;
function readSSOLogs() {
try {
const data = sessionStorage.getItem(sessionKey);
if (data) {
console.log(`[${new Date().toISOString()}] SSO Logs:`);
@KazChe
KazChe / harhar.js
Last active May 21, 2024 01:55
parse various section of a HAR file. uses nodejs
const fs = require('fs');
function readHarFile(filePath) {
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading the file:', err);
return;
}
const harData = JSON.parse(data);
analyzeHarData(harData);
const moment = require('moment');
var startDate = moment('2019-03-12');
var endDate = moment('2019-05-04');
var result = [];
var endOfMonth;
if (endDate.isBefore(startDate)) {
throw "End date must be greated than start date."
}
while (startDate.isBefore(endDate)) {
@KazChe
KazChe / weekly-iteration-between-two-dates.js
Created May 4, 2019 21:04
Given two dates generate weekly output dates
const moment = require('moment');
let startDate = moment('2019-03-12');
let endDate = moment('2019-05-04');
let result = [];
if (endDate.isBefore(startDate)) {
throw "End date must be greated than start date."
}
while (startDate.isBefore(endDate)) {
let endOfWeek = startDate.clone().endOf('week').format("YYYY-MM-DD")
@KazChe
KazChe / README-Template.md
Created September 4, 2018 23:28 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@KazChe
KazChe / AWS S3 Bucket Policy
Created September 4, 2018 23:05
AWS S3 bucket policy allowing only certain IP addresses to GET from it.
{
"Version": "2008-10-17",
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@KazChe
KazChe / Kubeless Installation - GKE
Created August 29, 2018 19:24
Kubeless Installation - GKE
$ gcloud container clusters create --cluster-version=1.9.7-gke.6 my-cluster --num-nodes 3 --zone us-central1-a
Creating cluster my-cluster...done.
kubeconfig entry generated for my-cluster.
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
my-cluster us-central1-a 1.9.7-gke.6 35.232.228.130 n1-standard-1 1.9.7-gke.6 3 RUNNING
$ kubectl create clusterrolebinding kubeless-cluster-admin --clusterrole=cluster-admin --user=<your gcp user-id>
clusterrolebinding.rbac.authorization.k8s.io "kubeless-cluster-admin" created
$ export RELEASE=$(curl -s https://api.github.com/repos/kubeless/kubeless/releases/latest | grep tag_name | cut -d '"' -f 4)
@KazChe
KazChe / .bash_profile
Created March 19, 2018 23:15 — forked from paulocheque/.bash_profile
.bash_profile example
# EDITOR=nano sudo visudo
# Change the following line: (:i to insert + esc to go back + :w to save + :q to quit)
# Defaults env_reset
# to:
# Defaults env_reset,timestamp_timeout=960 # in minutes
export PATH=$PATH:.
# export PATH=$PATH:/usr/bin
@KazChe
KazChe / git-pull-all
Created February 26, 2018 16:30 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all