Skip to content

Instantly share code, notes, and snippets.

@alixedi
alixedi / glob_field.py
Last active March 28, 2019 12:05
Django Form Field that supports Glob (terminal wildcard syntax) input.
import fnmatch
from django import forms
from django.core.exceptions import ValidationError
class GlobField(forms.CharField):
"""
Django does not support lookup type based on
[Glob](http://bit.ly/JkSbRZ). As a result, there
@alixedi
alixedi / custom_range_filters.py
Last active August 29, 2015 14:01
Custom range django-filters
from django import forms
from django_filters.filterset import FilterSet
from django_filters.widgets import RangeWidget
from django_filters.filters import Filter, RangeFilter
class CustomMultiValueField(forms.MultiValueField):
widget = RangeWidget
{
"settings": {
"icons" : true
},
"firstname": "Ali",
"familyname": "Zaidi",
"linkedin_id": "alixedi",
@alixedi
alixedi / rec_attr
Created January 29, 2015 14:51
A recursive getattr / setattr implementation.
# Source: https://mousebender.wordpress.com/2006/11/10/recursive-getattrsetattr/
def rec_getattr(obj, attr):
"""Get object's attribute. May use dot notation.
>>> class C(object): pass
>>> a = C()
>>> a.b = C()
>>> a.b.c = 4
>>> rec_getattr(a, 'b.c')
@alixedi
alixedi / usbstartup.sh
Last active August 29, 2015 14:14 — forked from hanbzu/usbstartup.sh
# The Ubuntu USB startup creator often crashes.
# This is an alternate way of doing the same process through the command line
# First plug in the USB pendrive. It will mount automatically
# Then check where it is (which device)
df
# Let's say we see it's in /dev/sdb1
# Then we have to use /dev/sdb and NOT /dev/sdb1
@alixedi
alixedi / resume.md
Last active April 21, 2023 12:37
My resume

Ali Zaidi

github.com/alixedi ~ alixedi.com ~ [email protected] ~ SC & BPS

Technical Lead with 15 years of experience in building and managing teams, products and IP for startups, enterprise and public sector. Specializes in leading cross-functioning teams to timely delivery of data-intensive projects involving complex production systems.

Experienced in hiring and leading high-performance teams; Designing and managing technical roadmaps and roll-out strategies; Managing stakeholder relations; Agile and Lean Product Development; Delivery of Data Science outcomes in production.

Technologies: Python, Django, Flask, JavaScript, React, Docker, Kubernetes, Spark, PostgreSQL, Celery, AWS, Google Cloud Platform, GOV.UK PaaS, Prometheus, ELK, CI/CD etc.

@alixedi
alixedi / conveyor.py
Last active August 14, 2023 05:31
ARM Coding Challenge - Production Line - by Ali Zaidi
# -*- coding: utf-8 -*-
"""
conveyor.conveyor
~~~~~~~~~~~~~~~~~
Models a conveyor belt in software.
Even for an interesting problem as this, I only had about an hour.
Therefore, when weighing my options amongst:
@alixedi
alixedi / correlation.py
Created April 16, 2015 09:21
Pearson product-moment correlation
from math import sqrt
from random import sample
from datetime import datetime
def correlation(ser1, ser2):
"""Computes Pearson product-moment correlation coefficient for the given 2
time series. See: http://bit.ly/1PHG1jy
>>> from correlation import correlation
>>> s1 = [random()*100 for i in range(100)]
>>> _s1 = [100-s1[i] for i in range(100)]
@alixedi
alixedi / fibonacci.py
Last active August 29, 2015 14:24 — forked from trtg/fibonacci.py
#from functools import lru_cache#python >=3.2
from functools32 import lru_cache#python 2.7
#from repoze.lru import lru_cache#python 2.7
#NOTE: you can use python -m trace --count fibonacci.py
#to see how many times each instruction is called
#@lru_cache(maxsize=500)#repoze.lru needs maxsize arg
@lru_cache()#using functools32
def fibonacci(n):