Skip to content

Instantly share code, notes, and snippets.

View munael's full-sized avatar

Muhammad N ElNokrashy munael

View GitHub Profile
@munael
munael / dataclass_from_dict.py
Created September 18, 2019 23:03 — forked from gatopeich/dataclass_from_dict.py
Python 3.7 dataclass to/from dict/json
from dataclasses import dataclass, fields as datafields
from ujson import dumps, loads
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json
@dataclass
class Point:
x: float
y: float
# Shallow dataclass can be rebuilt from dict/json:
@munael
munael / update_urls.js
Last active February 5, 2021 13:20
Update all active session URLs on Chrome
function fix_url(url) {
var bad = "";
var good = "";
return url.replace(bad, good);
}
chrome.tabs.query({}, function(tabs){
console.log(`Found ${tabs.length} tabs to update.`)
var _count = 0;
var n_changed = 0;
@munael
munael / graph.py
Last active October 4, 2022 23:06 — forked from c0nn3r/graph.py
Nice graph formatting. (from c0nn3r)
import re
import os
import glob
import pandas as pd
import matplotlib.pyplot as plt
from collections import OrderedDict
fig_size = [12, 9]