http://www.jitbit.com/news/181-jitbits-sql-interview-questions/
employees
- employee_id
- department_id
- boss_id
- name
| 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 |
http://www.jitbit.com/news/181-jitbits-sql-interview-questions/
employees
| 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", |
| # 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') |
| # 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 |
github.com/alixedi ~ alixedi.com ~ alixedi@gmail.com ~ 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.
| # -*- 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: |
| 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)] |
| #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): |