Skip to content

Instantly share code, notes, and snippets.

View docteurklein's full-sized avatar

Florian Klein docteurklein

View GitHub Profile
@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'
@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.
@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
@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).
@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.

@noteed
noteed / docker-ovs.md
Last active December 29, 2023 07:07
Docker - Open vSwitch setup
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
@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 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,
const puppeteer = require('puppeteer');
const { defineSupportCode } = require('cucumber')
defineSupportCode(({ Before, Given, When, Then }) => {
Before({ timeout: 60 * 1000 }, async function testCase() {
this.browser = await puppeteer.launch()
})
Given('I am on google with puppeteer', { timeout: 60 * 1000 }, async function testCase() {
this.page = await this.browser.newPage()