Skip to content

Instantly share code, notes, and snippets.

View mahmoud's full-sized avatar
Back on the grid!

Mahmoud Hashemi mahmoud

Back on the grid!
View GitHub Profile
@vasanthk
vasanthk / System Design.md
Last active May 6, 2024 13:07
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@kurtbrose
kurtbrose / f2cmd.py
Created August 25, 2015 04:58
Converts functions into simple commands.
'''
Converts functions into simple commands.
Turns function arguments into command line arguments, and docstrings into helpstrings.
Essentially an argparse shortcutter.
e.g.
@f2cmd.cmd(arg1={"type": int})
def my_main_function(arg1, arg2):
pass
@zatarra
zatarra / brain.py
Last active April 30, 2024 09:49
Python script to parse data from Mindflex headband and convert it into a powerfull EEG device
#!/usr/bin/python
import serial
import sys
latestByte = ('c')
lastByte = ('c')
inPacket = False
myPacket = []
PLENGTH = 0
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@mbostock
mbostock / .block
Last active February 14, 2024 17:51
Zoomable Circle Packing
license: gpl-3.0
height: 960
redirect: https://observablehq.com/@d3/d3-zoomable-circle-packing
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
# -*- coding: utf-8 -*-
IRREGULAR_PLURALS = {'alumnus': 'alumni',
'cactus': 'cacti',
'focus': 'foci',
'fungus': 'fungi',
'nucleus': 'nuclei',
'radius': 'radii',
'stimulus': 'stimuli',
'axis': 'axes',
@reclosedev
reclosedev / parsimonious_json.py
Last active August 29, 2018 19:13
JSON parser implementation using https://github.com/erikrose/parsimonious + simple demo and benchmark.
# -*- coding: utf-8 -*-
import ast
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
json_syntax = r'''
json_file = ws? json ws?
json = object / array
@SeanHayes
SeanHayes / fabfile.py
Last active September 27, 2020 20:10
Example Fabric fabfile.py. It's a hodgepodge of old scripts and probably isn't best practice (uWSGI ought to have an init script), but it should give you a practical idea of how to use Fabric. This fabfile relies heavily on custom settings from a Django project in order to be more DRY. Includes commands for setting up a fresh Ubuntu Server insta…
# -*- coding: utf-8 -*-
#Copyright (C) 2013 Seán Hayes
import my_project.settings as dj_settings
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute
from fabric.contrib.files import exists
from fabric.decorators import hosts, roles, runs_once
import json
import logging
import os