Skip to content

Instantly share code, notes, and snippets.

View ma7dev's full-sized avatar
🏗️
say/do <<< 1/2

Mazen ma7dev

🏗️
say/do <<< 1/2
View GitHub Profile
@ma7dev
ma7dev / commit.git
Created November 23, 2022 19:29
git commit template
type(scope): Subject
##################################################
# type:
# feat - A new feature
# fix - A bug fix
# chore - Other changes that don't modify src or test files
# build - Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
# refactor - Refactoring a specific section of the codebase
# ci - Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
# perf - A code change that improves performance
@ma7dev
ma7dev / index.html
Last active September 15, 2022 06:20
MSN Twitch alert - credit for the main code and design (https://codepen.io/abakos)
<html>
<head>
<title>
</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="app__notification" style="display: block;">
<div class="app__notification__title">
<img class="app__notification__title--icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAAsSAAALEgHS3X78AAACDUlEQVR42n2RT0jTARTH32+/9dtsc38cFTaTlktcNhdD3WgmbsTSRm3qthq5DRyzwxxbDYok2r+igzPtD6Qs2jLnUDGi3KFLBJ26dOlQE+oWFB26SAaB31ILKst3eI/H4/Pe971HLMvS38YjPu1U1VIFJ9xQ2yoS/5Yx62GHSkmBjP+JN2HH/g49RGKxnjYzPssn92jEOfexiMR8CntdftTuM4HZDJLIZNQ9kcClF7NwZwuochZQ1xaFgM8oWIYh3r9oAceRxnZkbrc/AEVPBvLOEhqNHvx3CvOzjUqjJvNpB+qsNjTbPJDLpIeIYclubCBTfc1GsKXLQOlnyWPJmTy6w8MwBlxQtRrx+IJLiMn+kffnLRBwwkXisbw1wHHmBE1/ePBl6tMMRksLaLE+hK73HkZCXuCOG19TVnyOGrBNKlmXqz3cStfflZb6ijlcWywiX55HV7CAms7b8Dl8+JaxYOVyG8pBA7hKBYjjbyHn2NlTxlQWDbEhpF/mkHw+heNXJ7DLnkG9OYLX5w5gaUiNp6lmECN6S1VyKVnjsWXtwF2YUjH0L2TgnRxD+5VxKAfC4PUcxaOCGSg3YTZ78oc03ps1eUrVnmW1RodGy0G4b16EZ/wG2uM5dMTvQ5sOwReJYPqWD006/eo+FX9cr1IsocHB6Cun
@ma7dev
ma7dev / cool_script.sh
Last active September 5, 2022 13:23
takes requirements.txt file without module versions and annotates it with the latest set of module versions that won't result in build/runtime errors.
#!/bin/bash
# TODO: you will need to have conda installed
# create a python environment
conda create -n env_tmp python=3.8.13 -y
# activate environment
conda activate env_tmp
[tool.poetry]
name = "env_test"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = "3.8.13"
[tool.poetry.dev-dependencies]
@ma7dev
ma7dev / README.md
Created June 7, 2022 01:18
Store and Install VSCode extensions

VSCode

# conda env export > environment. yml
code --list-extensions > requirements.txt

# conda env create --file environment.yml
./install.sh
@ma7dev
ma7dev / test_sorting.py
Created April 25, 2022 10:30
Testing sorted()
import random
def naive_way_of_sorting(arr):
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if arr[i] > arr[j]:
arr[i], arr[j] = arr[j], arr[i]
return arr
def test_sorting(size):
@ma7dev
ma7dev / _.md
Last active July 19, 2022 13:23
Mazen's way of learning

How I learn

Consume the content

When I read from an article, PDF, or any text-based resource, I follow the following rules:

  • Use two highlightning colors (orange and green) and alternate between them to separate ideas.
  • After reading for sometime or feel that I have lost or might lose track of what I have read before, I come back and write marginal notes (in red) to describe the general idea for each highlighted section.
  • After completing reading the content, I revisit my notes and try to have a solid understanding of the content and add more marginal notes with a different color (blue).
  • Re-write my notes and general ideas into a piece of paper to understand the flow of ideas (just focus on important things and ignore details that aren't important)
@ma7dev
ma7dev / notes.md
Last active January 23, 2022 05:06
Sudo Group's Weekly Meeting Notes

Sudo Group's Weekly Meeting Notes

Join our community of people interested in Software Engineering. link

#10 - How to write good code?

Host: @sudomaze

Note-taker: @h7lc0n (notes)

@ma7dev
ma7dev / main.ipynb
Last active January 4, 2022 16:53
Enabling/Disabling xkcd drawing style in Matplotlib
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ma7dev
ma7dev / blockchain.py
Created November 19, 2021 06:21
A blockchain made from scratch in ~50 lines
# source: https://twitter.com/PrasoonPratham/status/1461267623266635778/photo/1 (@PrasoonPratham on Twitter)
import datetime
import hashlib
class Block:
def __init__(self, data):
self.data = data
self.blockNo = 0
self.next = None
self.nonce = 0