Skip to content

Instantly share code, notes, and snippets.

View mie00's full-sized avatar

Mohamed I. Elawadi mie00

View GitHub Profile
@abom
abom / bills.py
Last active November 9, 2018 13:45 — forked from mie00/bills.py
For bills and stuff
#!/usr/bin/env python
def calc(gross, delivery, **d):
"""
usage:
>>> calc(120, 9,
Ashraf=40,
Thabet=20,
Awadi=20,
Ghanem=20)
@Explosion-Scratch
Explosion-Scratch / Compress string.js
Created November 1, 2021 18:51
Compress string using gzip and native browser APIs
function compress(string, encoding) {
const byteArray = new TextEncoder().encode(string);
const cs = new CompressionStream(encoding);
const writer = cs.writable.getWriter();
writer.write(byteArray);
writer.close();
return new Response(cs.readable).arrayBuffer();
}
function decompress(byteArray, encoding) {