Skip to content

Instantly share code, notes, and snippets.

View aliev's full-sized avatar
🎯
Focusing

Ali Aliyev aliev

🎯
Focusing
View GitHub Profile
@aliev
aliev / join_promotion
Created April 2, 2018 04:00 — forked from akaariai/join_promotion
Django 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]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aliev
aliev / gist:c11c141493c66326ef76275b549e80b6
Created December 25, 2018 14:51 — forked from ragtime/gist:2cfb981fbc5676182d64
simple example of a group definition for the relational algebra calculator
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
@aliev
aliev / migrations.md
Last active July 23, 2019 05:21 — forked from majackson/migrations.md
Django migrations without downtime

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

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 / btags.vim
Last active December 17, 2022 12:10
" ----------------------------------------------------------------------------
" BTags
" ----------------------------------------------------------------------------
function! s:align_lists(lists)
let maxes = {}
for list in a:lists
let i = 0
while i < len(list)
let maxes[i] = max([get(maxes, i, 0), len(list[i])])
let i += 1
package main
func gen(f int) chan int {
// Creating non-buffered channel
c := make(chan int)
go func() {
for i := 0; i < f; i++ {
// This part of the code will be blocked until someone will read from c channel.
c <- i