Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ali Aliyev aliev

🎯
Focusing
View GitHub Profile
View lru_cache.py
class Node:
def __init__(self, value, key=None, next=None, prev=None):
self.value = value
self.next = next
self.prev = prev
self.key = key
class LRUCache:
@aliev
aliev / gist:c11c141493c66326ef76275b549e80b6
Created Dec 25, 2018 — forked from ragtime/gist:2cfb981fbc5676182d64
simple example of a group definition for the relational algebra calculator
View gist:c11c141493c66326ef76275b549e80b6
group: bank example
description[[ the data for this dataset was generated using <http://www.generatedata.com/>
* the relation _Customers_ contains basic information about the customers of the bank.
* the relation _Accounts_ contains the basic information of a single account. Note that a customer can have any number of accounts.
* the relation _PremiumCustomers_ contains the customer-ids of all customers with a total balance over 1000
]]
Customers = { cid firstname lastname
View spectral_param.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View spectral_param.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aliev
aliev / join_promotion
Created Apr 2, 2018 — forked from akaariai/join_promotion
Django join promotion
View join_promotion
=========================
Join promotion in the ORM
=========================
[NOTE: We need better terms than promote and demote for changing the join
type. These terms are extremely easy to mix up. Maybe the ORM methods could
be to_inner_joins and to_louter_joins instead of promote_joins and demote_joins?
I tried to clean up the mis-usages of promotion/demotion but there could still
be some cases where these are mixed up]
@aliev
aliev / migrations.md
Last active Jul 23, 2019 — forked from majackson/migrations.md
Django migrations without downtime
View migrations.md

Good article also here: http://pankrat.github.io/2015/django-migrations-without-downtimes/

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

View query_string.py
from django import template
register = template.Library()
@register.simple_tag
def url_encode(request, **kwargs):
"""
For example, on the page, we have
1. filters,
View .tmux.conf
# Terminal
set -g default-terminal "screen-256color"
# No delay for escape key press
set -sg escape-time 0
# Enable mouse
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
@aliev
aliev / .settings
Last active Sep 10, 2015
Django project specific options for Vim
View .settings
"let g:django_settings_module=".settings."
let $PYTHONPATH=""
if !exists("g:django_settings_module")
let $DJANGO_SETTINGS_MODULE = printf("%s.settings", split(getcwd(), '/')[-1:][0])
else
let $DJANGO_SETTINGS_MODULE = g:django_settings_module
endif
View gist:2820a218b5a7403739b6
" | incsearch.vim | / ? g/ n N * # g* g# | {{{
let g:incsearch#auto_nohlsearch = 1
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)