Skip to content

Instantly share code, notes, and snippets.

View SadeghHayeri's full-sized avatar
🕷️

Sadegh Hayeri SadeghHayeri

🕷️
View GitHub Profile
@SadeghHayeri
SadeghHayeri / progress.sh
Last active November 1, 2022 05:05
Migration Progress
#!/usr/bin/env bash
# shellcheck disable=SC2059
readonly Bold='\e[1m'
readonly Bred='\e[1;31m'
readonly Byellow='\e[1;33m'
readonly reset='\e[0m'
__die() { echo -e " ${Bred}[x]${reset} ${Bold}Error :${reset} ${*}" >&2 && exit 1; }
@SadeghHayeri
SadeghHayeri / kubernetes-new-namespace.sh
Last active May 27, 2019 09:26
Create new namespace (+auth) with resource limits for Kubernetes
#!/bin/bash
set -e
NAME=$1
function ised() {
local exp=$1
local location=$2
if [[ $OSTYPE == darwin* ]]; then
#!/bin/bash
function unarchive_all() {
for f in *.zip
do
unzip $f -d "$(echo $f | cut -d . -f 1)"
rm $f
done
for f in *.rar
@SadeghHayeri
SadeghHayeri / HTTP Parser (javascript)
Last active March 15, 2019 17:20
HTTP Parser in JavaScript
class HTTP {
static parseHeaders(headerLines) {
const headers = {};
headerLines.forEach((line) => {
const lineParts = line.split(/ *: */);
headers[lineParts[0]] = lineParts[1];
});
return headers
}