Skip to content

Instantly share code, notes, and snippets.

View bazen-teklehaymanot's full-sized avatar
💭
I may be slow to respond.

Bazen bazen-teklehaymanot

💭
I may be slow to respond.
View GitHub Profile
@bazen-teklehaymanot
bazen-teklehaymanot / app.py
Created March 7, 2024 18:45 — forked from deepaksood619/app.py
Setting up Logging in Python and Flask Application the right way
import json
import requests
import logging
import os
from logging.config import dictConfig
# debug settings
debug = eval(os.environ.get("DEBUG", "False"))
from flask import Flask, make_response, request
@bazen-teklehaymanot
bazen-teklehaymanot / ExceptionHelpers.cs
Created December 23, 2023 17:18 — forked from karenpayneoregon/ExceptionHelpers.cs
Using Spectre.Console NuGet package to colorize runtime exceptions
/// <summary>
/// Custom setting for presenting runtime exceptions using AnsiConsole.WriteException.
///
/// The idea here is to present different types of exceptions with different colors while
/// one would be for all exceptions and the other(s) for specific exception types.
/// </summary>
public class ExceptionHelpers
{
/// <summary>
/// Provides colorful exception messages in cyan and fuchsia
@bazen-teklehaymanot
bazen-teklehaymanot / struct_to_bytes.go
Created February 21, 2023 10:06 — forked from SteveBate/struct_to_bytes.go
Example of converting a struct to a byte slice, compressing with gzip, and saving to file followed by the reverse process back to a struct
package main
import (
"bytes"
"compress/gzip"
"encoding/gob"
"fmt"
"io/ioutil"
"log"
"os"
@bazen-teklehaymanot
bazen-teklehaymanot / Index.tsx
Created April 29, 2021 18:12
Conditional rendering in react
import ReactDOM from 'react-dom';
import React, { Fragment, FC, useState, useEffect } from 'react';
import reportWebVitals from './reportWebVitals';
export enum StateTypes{
Init='INIT',
Error='ERROR',
Success='SUCCESS',