Skip to content

Instantly share code, notes, and snippets.

View arkadiybutermanov's full-sized avatar

Arkadii Butermanov arkadiybutermanov

View GitHub Profile
@arkadiybutermanov
arkadiybutermanov / generate_series.sql
Created March 20, 2020 15:49
Generating Benchmarking data with Postgres
-- creating example tables
CREATE TABLE audits(id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, created_at timestamp NOT NULL);
CREATE TABLE objectives(id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, created_at timestamp NOT NULL, audit_id integer REFERENCES audits(id) NOT NULL);
-- generating 1000 audits
INSERT INTO audits(title, created_at) SELECT format('Audit #%s', id), current_timestamp FROM generate_series(1, 1000) AS id;
-- generating 100 objectives for each existing audits
INSERT INTO objectives(title, created_at, audit_id) SELECT format('Objective #%s', objective_id), current_timestamp, audits.id FROM audits, generate_series(1, 100) as objective_id;
@arkadiybutermanov
arkadiybutermanov / gist:11369895
Last active August 29, 2015 14:00
Generate brakeman/rubocop ignore files

Brakeman setup:

Create ignore file, please name it .brakeman-ignore

bin/brakeman --interactive-ignore

Add to script/ci

bin/brakeman --quiet --skip-libs --exit-on-warn --ignore-config=.brakeman-ignore