Skip to content

Instantly share code, notes, and snippets.

View emonhossainraihan's full-sized avatar
🎯
Focusing on topology

EmonHR emonhossainraihan

🎯
Focusing on topology
View GitHub Profile
list = []
n = 3
print([i for i in range(n)])
for x in range(n):
    for y in range(n):
        nx = (2 * x + y) % n
        ny = (x + y) % n
        list.append([nx,ny])
print(list)
%% Read in files and extrapolate mortality rate
x = csv.read('life.csv','format', '%f %f');
age = x{1};
prob = x{2};
model = stats.lm(log(prob(61:end)), log(age(61:100)));
pfun = @(a) util.if_(a<60, @()prob(a), util.if_(a>121, 1, exp(model.beta(1) + model.beta(2) * log(a))));
@emonhossainraihan
emonhossainraihan / interactive_google_oauth2.py
Created August 9, 2021 16:17 — forked from frankie567/interactive_google_oauth2.py
Interactive Google OAuth2 flow with Streamlit
import asyncio
import streamlit as st
from httpx_oauth.clients.google import GoogleOAuth2
st.title("Google OAuth2 flow")
"## Configuration"
client_id = st.text_input("Client ID")

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@emonhossainraihan
emonhossainraihan / bobp-python.md
Created January 26, 2021 06:19 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens

Why do Microservices?

  • Independent releases
  • Limited scope of work
  • Stringer decoupling
  • Independent scaling
  • Independent storage

A successful organization grows:

@emonhossainraihan
emonhossainraihan / markdown-text-101.md
Created November 5, 2020 14:53 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__

@emonhossainraihan
emonhossainraihan / after_res_hooks.js
Created September 5, 2020 11:20 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups

Requiring Modules

You can think of the require module as the command and the module module as the organizer of all required modules.

REPL stands for Read Eval Print Loop and it represents a computer environment

The main object exported by the require module is a function. When Node invokes that require() function with a local file path as the function's only argument, Node goes through the following sequence of steps: Resolving > Loading > Wrapping > Evaluating > Caching

The whole process of requiring/loading a module is synchronous. we cannot change the exports object asynchronously(in a callback).

Jest

In our project we have seen that our passport authentication badly depend on cookie named session and session.sig.

We can manully test this like this:

Node REPL