This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//#include <unistd.h> | |
import "C" | |
import ( | |
"context" | |
"log" | |
"math/rand" | |
"runtime" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
"sync" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"reflect" | |
"strings" | |
) | |
type Person struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
"github.com/go-redis/redis" | |
"log" | |
"reflect" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCATIONS = """ | |
country | |
UK | |
city | |
London | |
Guildford | |
county | |
Surray | |
Sussex | |
Belgium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unicode/translit.h> | |
class TranslitConverter | |
{ | |
static const UnicodeString TRANSLITERATION_RULES; | |
public: | |
TranslitConverter() | |
{ | |
UErrorCode status = U_ZERO_ERROR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- partition by month | |
-- https://www.postgresql.org/docs/9.5/static/ddl-partitioning.html | |
begin; | |
drop trigger if exists insert_master_trigger on master; | |
drop function if exists master_insert(); | |
drop table if exists master cascade; | |
create table master( | |
id bigserial primary key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- partition by month | |
-- https://www.postgresql.org/docs/9.5/static/ddl-partitioning.html | |
begin; | |
drop trigger if exists insert_master_trigger on master; | |
drop function if exists master_insert(); | |
drop table if exists master cascade; | |
create table master( | |
id bigserial primary key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from types import NoneType | |
class Field(object): | |
def __init__(self, expected_types, *default): | |
self.name = None # set by metaclass | |
self.internal_name = None # set by metaclass | |
self.expected_types = expected_types | |
if default: | |
self.default = default[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
""" | |
Pagination model for sorted docs collection, that is periodically updated. | |
The key ideas: | |
- all docs have sequential id | |
- docs are sorted by composite key (weight, sequential id) | |
- response to page request containse 'next_offset' (a composite key) that should be used to get next page | |
""" |
NewerOlder