Skip to content

Instantly share code, notes, and snippets.

View furqanbaqai's full-sized avatar
🎯
Focusing

Muhammad Furqan furqanbaqai

🎯
Focusing
View GitHub Profile
@furqanbaqai
furqanbaqai / clean.md
Created June 12, 2020 06:03 — forked from Kevinrob/clean.md
Clean up microk8s registry
registry=localhost:32000
repositories=$(curl ${registry}/v2/_catalog)
for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
  echo $repo
  tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
  for tag in $tags; do
    echo $tag
    curl -v -sSL -X DELETE "http://${registry}/v2/${repo}/manifests/$(
 curl -sSL -I \
@furqanbaqai
furqanbaqai / grade-school.ts
Created May 21, 2020 20:20
One more abstraction of the gradeschool.ts
class GradeSchool{
private _studentRoster: Map<number,string[]> = new Map();
public studentRoster(): Map<string,string[]> {
const rosterMap: Map<string,string[]> = new Map();
for(const key of this._studentRoster.keys()){
rosterMap.set(key.toString(),this.studentsInGrade(key));
}
return rosterMap;
}
@furqanbaqai
furqanbaqai / GradeShool.ts
Last active May 21, 2020 19:18
types, maps, iterators
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-4.html
// https://exercism.io/tracks/typescript/exercises/grade-school/solutions/0798baf5852e4b6e95220a1cbf894eb0
// https://www.digitalocean.com/community/tutorials/typescript-type-alias
type RosterType<T> = Map<T, string[]>;
class GradeSchool{
private roster: RosterType<number> = new Map();
public studentRoster(): RosterType<string> {
const strRoster: RosterType<string> = new Map();
@furqanbaqai
furqanbaqai / robot-name.ts
Created May 20, 2020 11:19
Generating alpha numeric characters in javascript
/**
* Manage robot factory settings.
*
* When robots come off the factory floor, they have no name.
*
* The first time you boot them up, a random name is generated in the format
* of two uppercase letters followed by three digits, such as RX837 or BC811.
*
* Every once in a while we need to reset a robot to its factory settings,
* which means that their name gets wiped. The next time you ask, it will
@furqanbaqai
furqanbaqai / .bashrc
Created August 4, 2019 18:17 — forked from pythoninthegrass/.bash_aliases
WSL Ubuntu .bashrc
# SOURCES:
# http://unix.stackexchange.com/a/122188
# https://natelandau.com/my-mac-osx-bash_profile
# https://jonsuh.com/blog/bash-command-line-shortcuts
# https://news.ycombinator.com/item?id=8159771
# .bashrc: https://gist.github.com/evdokimovm/67e4fcd938af98528aa108574626e522
bash -c zsh
# Verify that shell is interactive
@furqanbaqai
furqanbaqai / rna-transcription.js
Created August 2, 2019 12:37
DNA to RNA mapping using JSON
/**
*
* Given a DNA strand, return its RNA complement (per RNA transcription).
Both DNA and RNA strands are a sequence of nucleotides.
The four nucleotides found in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T).
The four nucleotides found in RNA are adenine (A), cytosine (C), guanine (G) and uracil (U).
Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
G -> C
C -> G
//
// Generate Certificates / Keys using following URL:
// https://adangel.org/2016/08/29/openssl-rsa-java/
// NOTE: Code is compiled using IBM Java rather than Oracle
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
@furqanbaqai
furqanbaqai / BMCTokenGenerator.py
Created January 18, 2018 10:47
Utility Class library for generating BMC Tokens - Login and Logout function
"""
Utility Class library for generating BMC Tokens
BMC True Sight Vault
https://gist.github.com/furqanbaqai/07e250fc3f11e42071c8f4d8c2729562
Authur: Muhammad Furqan Baqai [MFB] (baqai.furqan@gmail.com)
Change History
[MFB:2018-01-16] Initial checkin
"""
import json
@furqanbaqai
furqanbaqai / bmcTrueSight.py
Last active January 11, 2018 04:27
Utility procedure for updating BMC True Sight Security Vault with password fetched from other Enterprise Password Vault
"""
Utility for fetching password from ARCOS and updating
BMC True Sight Vault
https://gist.github.com/furqanbaqai/07e250fc3f11e42071c8f4d8c2729562
Authur: Muhammad Furqan Baqai [MFB] (baqai.furqan@gmail.com)
Change History
[MFB:2018-01-08] Initial checkin
"""
@furqanbaqai
furqanbaqai / stomp_example.py
Created January 9, 2018 18:35 — forked from tdpreece/stomp_example.py
stomp.py example
# Python 2.7.6
# stomp.py v4.1.5 (https://pypi.python.org/pypi/stomp.py)
import time
import stomp
class MyListener(stomp.ConnectionListener):
def on_message(self, headers, message):
print('MyListener:\nreceived a message "{}"\n'.format(message))