Skip to content

Instantly share code, notes, and snippets.

View zeeshanalisyed's full-sized avatar

Zeeshan Haider zeeshanalisyed

View GitHub Profile
@zeeshanalisyed
zeeshanalisyed / 10-days-of-statistics-python-1.py
Last active October 26, 2021 08:45
10-days-of-statistics-python-1.py
import sys
import functools
import statistics
lines = sys.stdin.readlines()
nOfLines = int(lines[0][:-1])
nlist = [float(x) for x in lines[1].split()]
@zeeshanalisyed
zeeshanalisyed / rancher-install.MD
Last active July 10, 2021 07:50
Rancher Installation with Docker

Instruction for docker

  • Pre-Installation Steps
    • basic steps
      $ sudo apt update
      $ sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg \
@zeeshanalisyed
zeeshanalisyed / config-undercloud.sh
Last active June 21, 2021 06:26 — forked from cloudnull/config-undercloud.sh
VM and vBMC Setup - installation and setup example
# pre
yum -y install epel-release yum-plugin-priorities
# install tripleo repos
# This will pull the latest version RPM
PKG=$(curl https://trunk.rdoproject.org/centos7/current/ | grep python2-tripleo-repos- | awk -F'"' '{print $8}')
# This will install it
yum install -y https://trunk.rdoproject.org/centos7/current/${PKG}
This file has been truncated, but you can view the full file.
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-cron:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-glance-api:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-haproxy:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-heat-api-cfn:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-heat-engine:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-ironic-api:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect docker://docker.io/tripleorocky/centos-binary-ironic-conductor:current-tripleo
INFO:tripleo_common.image.image_uploader:Running skopeo inspect d

Spark - High availability

Components in play

As a reminder, here are the components in play to run an application:

  • The cluster:
    • Spark Master: coordinates the resources
    • Spark Workers: offer resources to run the applications
  • The application:
@zeeshanalisyed
zeeshanalisyed / validate-bracket-string.js
Created June 29, 2019 12:17
validates if the string is valid based on the opening closing different kind of nested brackets or set of brackets
const mapopen = ['[', '{', '(']
const mapclosing = [']', '}', ')']
function isValid(input) {
let openmatch, elem
let list = []
for (let i = 0; i < input.length; i++) {
elem = input[i]
if (mapclosing.indexOf(elem) > -1) {
openmatch = mapopen[mapclosing.indexOf(elem)]
@zeeshanalisyed
zeeshanalisyed / get-pair-from-array.js
Created June 29, 2019 12:09
this gist explains how to get number of pairs from an array
var array = [10, 20, 20, 10, 10, 30, 50, 10, 20, 4, 20, 30, 500, 500, 500];
const unique = (array) => array.filter((item, i, list) => list.indexOf(item) === i);
const countInArray = (array, what) => array.filter(item => item == what).length;
const keys = unique(arr)
let result = 0;
keys.map(key => {
var pair = Math.floor(countInArray(arr, key)/2);
if (pair > 0) {
@zeeshanalisyed
zeeshanalisyed / go-twitter-stream.go
Created June 22, 2019 09:25
file provides simple example of go-twitter stream
package main
import (
"fmt"
"flag"
"os"
"log"
"os/signal"
"syscall"
var zookeeper = require('node-zookeeper-client');
var client = zookeeper.createClient(`${process.env.ZKPR_HOST || localhost}:${process.env.ZKPR_PORT || 2181}`);
client.once('connected', function () {
console.log('Connected to ZooKeeper.');
// Create zNode
let zNode = `/zoo${Math.floor((Math.random() * 100000) + 1)}`;
client.create(
@zeeshanalisyed
zeeshanalisyed / set_env_var
Created July 16, 2018 06:41
bash function sets the environment variable
#!/bin/bash
# @description: add this file to path /bin/
# set_env_var variable_name variable value
VAR=$1
VAL=$2
set_env_v () {
echo 'export '$1'='$2 >> /home/$USER/.bashrc
}