Skip to content

Instantly share code, notes, and snippets.

View docteurklein's full-sized avatar

Florian Klein docteurklein

View GitHub Profile
-- Создаем базы данных
CREATE DATABASE "sahrding-main" OWNER = dev; -- Основная
CREATE DATABASE "sahrding-part-2016" OWNER = dev; -- Шард 1
CREATE DATABASE "sahrding-part-2017" OWNER = dev; -- Шард 2
-- Следующие запросы выполняем для каждой базы данных sahrding-part-*
-- Создаем таблицы где будут храниться реальные данные.
-- Со всеми необходимыми индексами и ограничениями.
CREATE TABLE content (
id int not null,
@marcocitus
marcocitus / generate-products.sql
Last active February 17, 2023 12:57
Generate mock product data in PostgreSQL
CREATE TABLE IF NOT EXISTS words (
word text
);
CREATE TABLE IF NOT EXISTS product (
product_id int not null,
name text not null,
description text not null,
price decimal(12,2),
attributes jsonb,
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french );
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, french_stem;
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english );
ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, english_stem;
CREATE TEXT SEARCH CONFIGURATION de ( COPY = german );
ALTER TEXT SEARCH CONFIGURATION de ALTER MAPPING
@noteed
noteed / docker-ovs.md
Last active December 29, 2023 07:07
Docker - Open vSwitch setup
@tmaiaroto
tmaiaroto / collection+json.md
Last active May 23, 2022 12:29
JSON Based Hypermedia Structures - Notes & Comparisons

Collection+JSON format

http://amundsen.com/media-types/collection/examples/

This format takes into consideration collections (much like Siren). It also takes into consideration versioning. However, I'm not certain version matters in the data set if it pertains to an API version. That is best left being in the API URL. It could pertain to collection version, but I'm not sure the point. Documentation says each collection should have a version - but says nothing more about meaning or why.

Items are clearly distinct in this format and are organizationally positioned separate from links.
This is by far the most collision free structure.

However, the data format itself is a bit strange...Every field being an array. Data is always an array of objects. I understand the flexibility this presents and am not 100% against it. I just believe it's perhaps not needed as things could change based on the client application.

@rnewson
rnewson / gist:8256811
Created January 4, 2014 16:02
trivial SOCKS5 handling in Erlang.
#!/usr/bin/env escript
-define(VERSION, 16#05).
-define(CONNECT, 16#01).
-define(NO_AUTH, 16#00).
-define(RESERVED, 16#00).
-define(ATYP_IPV4, 16#01).
-define(ATYP_DOMAINNAME, 16#03).
@immutef
immutef / dnsmasq.conf
Created October 17, 2013 16:26
MacOS, Vagrant, dnsmasq, ipfw
listen-address=127.0.0.1
# interface=lo
address=/dev/127.0.0.1
address=/local/127.0.0.1
no-dhcp-interface=no
@cobusc
cobusc / postgresql_date_function_index_howto.md
Last active March 12, 2024 12:10
Short explanation of the issues faced when trying to create a PostgreSQL index using the date() function and how to resolve it.
@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
@callado4
callado4 / behat-phantomjs-webdriver.md
Last active January 24, 2021 17:10
Instructions on how to make behat (with mink) use the phantomjs webdriver to run headless browser tests

Making behat use phantomjs for the tests

If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0

phantomjs:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://dev.local
            goutte: ~
            selenium2:
 wd_host: "http://localhost:8643/wd/hub"