Skip to content

Instantly share code, notes, and snippets.

View KrzysztofMadejski's full-sized avatar

Krzysiek Madejski KrzysztofMadejski

View GitHub Profile
@KrzysztofMadejski
KrzysztofMadejski / business_errors.go
Created April 15, 2020 07:32
Thinking about business errors implementation in go
type SchedulingError struct {
error
}
func (e *SchedulingError) Unwrap() error { return e.error }
// TODO NewSchedulingErrorf(string, ...args)
func NewSchedulingError(err error) SchedulingError {
return SchedulingError{error: err}
IdObserver TeamId Gmina PollingStationNumber A.01 A.02 A.03 A.04 A.05 A.06 A.07 A.08 A.09 A.10 A.11 A.12-inne A.12-naklejka foliowa A.12-opaska samozaciskowa A.12-opieczetowany i podpisany pasek papieru A.13 A.14 A.15 A.16 A.17 A.18 A.19 A.20 A.21 A.22 A.23 A.24 A.25 A.26 A.27 A.28 A.29 A.30 A.31 A.32 A.33 A.34 B.01 B.02 B.03 B.04 B.05 B.06 B.07 B.08 B.09 B.10 B.11 B.12 B.13 B.14 B.15 B.16 B.17 B.18 B.19 B.20 B.21 B.22 B.23 B.24 B.25 B.26 B.27 B.28 B.29-inne B.29-naklejka foliowa B.29-opaska samozaciskowa B.29-opieczetowany i podpisany pasek papieru B.30 B.31 B.32 B.33 B.34 B.35 B.36 B.37 B.38 B.39 B.40 B.41 B.42 B.43 B.44 B.45 B.46 B.47 B.48 B.49 B.50 C1.01 C1.02 C1.03 C1.04 C1.05 C1.06 C1.07 C1.08 C1.09 C1.10 C1.11 C1.12 C1.13 C1.14 C1.15 C1.16 C1.17 C1.18 C1.19 C1.20 C1.21 C1.22 C1.23 C1.24 C1.25 C1.26 C1.27 C1.28 C1.29 C1.30 C1.31 C1.32 C1.33 C2.01 C2.02 C2.03 C2.04 C2.05 C2.06 C2.07 C2.08 C2.09 C2.10 C2.11 C2.12 C2.13 C2.14 C2.15 C2.16 C2.17 C2.18 C2.19 C2.20 C2.21 C2.22 C2.23 C2.24 C2.25 C2.26 Cg.01 Cg.
IdObserver TeamId Gmina PollingStationNumber A.01 A.02 A.03 A.04 A.05 A.06 A.07 A.08 A.09 A.10 A.11 A.12-inne A.12-naklejka foliowa A.12-opaska samozaciskowa A.12-opieczetowany i podpisany pasek papieru A.13 A.14 A.15 A.16 A.17 A.18 A.19 A.20 A.21 A.22 A.23 A.24 A.25 A.26 A.27 A.28 A.29 A.30 A.31 A.32 A.33 A.34 B.01 B.02 B.03 B.04 B.05 B.06 B.07 B.08 B.09 B.10 B.11 B.12 B.13 B.14 B.15 B.16 B.17 B.18 B.19 B.20 B.21 B.22 B.23 B.24 B.25 B.26 B.27 B.28 B.29-inne B.29-naklejka foliowa B.29-opaska samozaciskowa B.29-opieczetowany i podpisany pasek papieru B.30 B.31 B.32 B.33 B.34 B.35 B.36 B.37 B.38 B.39 B.40 B.41 B.42 B.43 B.44 B.45 B.46 B.47 B.48 B.49 B.50 C1.01 C1.02 C1.03 C1.04 C1.05 C1.06 C1.07 C1.08 C1.09 C1.10 C1.11 C1.12 C1.13 C1.14 C1.15 C1.16 C1.17 C1.18 C1.19 C1.20 C1.21 C1.22 C1.23 C1.24 C1.25 C1.26 C1.27 C1.28 C1.29 C1.30 C1.31 C1.32 C1.33 C2.01 C2.02 C2.03 C2.04 C2.05 C2.06 C2.07 C2.08 C2.09 C2.10 C2.11 C2.12 C2.13 C2.14 C2.15 C2.16 C2.17 C2.18 C2.19 C2.20 C2.21 C2.22 C2.23 C2.24 C2.25 C2.26 Cg.01 Cg.
IdObserver Teryt PollingStationNumber A.01 A.01+ A.02 A.02+ A.03 A.03+ A.04 A.04+ A.05 A.05+ A.06 A.06+ A.07 A.07+ A.08 A.08+ A.09 A.09+ A.10 A.10+ A.11 A.11+ A.12 A.12+ A.13 A.13+ A.14 A.14+ A.15 A.15+ A.16 A.16+ A.17 A.17+ A.18 A.18+ A.19 A.19+ A.20 A.20+ A.21 A.21+ A.22 A.22+ A.23 A.23+ A.24 A.24+ B.01 B.01+ B.02 B.02+ B.03 B.03+ B.04 B.04+ B.05 B.05+ B.06 B.06+ B.07 B.07+ B.08 B.08+ B.09 B.09+ B.10 B.10+ B.11 B.11+ B.12 B.12+ B.13 B.13+ B.14 B.14+ B.15 B.15+ B.16 B.16+ B.17 B.17+ B.18 B.18+ B.19 B.19+ B.20 B.20+ B.21 B.21+ B.22 B.22+ B.23 B.23+ B.24 B.24+ B.25 B.25+ B.26 B.26+ B.27 B.27+ B.28 B.28+ B.29 B.29+ B.30 B.30+ B.31 B.31+ B.32 B.32+ B.33 B.33+ B.34 B.34+ B.35 B.35+ B.36 B.36+ B.37 B.37+ B.38 B.38+ C.01 C.01+ C.02 C.02+ C.03 C.03+ C.04 C.04+ C.05 C.05+ C.06 C.06+ C.07 C.07+ C.08 C.08+ C.09 C.09+ C.10 C.10+ C.11 C.11+ C.12 C.12+ C.13 C.13+ C.14 C.14+ C.15 C.15+ C.16 C.16+ C.17 C.17+ C.18 C.18+ C.19 C.19+ C.20 C.20+ C.21 C.21+ C.22 C.22+ C.23 C.23+ C.24 C.24+ C2.01 C2.01+ C2.02 C2.02+ C2.03 C2.03+ C
def package_create(context, data_dict):
'''Create a new dataset (package).
You must be authorized to create new datasets. If you specify any groups
for the new dataset, you must also be authorized to edit these groups.
Plugins may change the parameters of this function depending on the value
of the ``type`` parameter, see the
:py:class:`~ckan.plugins.interfaces.IDatasetForm` plugin interface.
:param name: the name of the new dataset, must be between 2 and 100
characters long and contain only lowercase alphanumeric characters,
``-`` and ``_``, e.g. ``'warandpeace'``
from pylons import config, cache
import sqlalchemy.exc
import ckan.logic as logic
import ckan.lib.maintain as maintain
import ckan.lib.search as search
import ckan.lib.base as base
import ckan.model as model
import ckan.lib.helpers as h
@KrzysztofMadejski
KrzysztofMadejski / admin.py
Last active October 16, 2017 23:03
Overrided controllers
from pylons import config
import ckan.lib.base as base
import ckan.lib.helpers as h
import ckan.lib.app_globals as app_globals
import ckan.model as model
import ckan.logic as logic
import ckan.new_authz
c = base.c
# TODO: anonimization of dat
mysql fg -u fg -pfg -e "UPDATE fg_users SET user_pass=MD5('Password1'), user_email=CONCAT('user', ID, '@faktograf.hr'), display_name='Faktograf user', user_url=NULL, user_login=CONCAT('user',ID), user_nicename=CONCAT('user',ID);"
mysql fg -u fg -pfg -e "DELETE FROM fg_usermeta WHERE meta_key != 'fg_capabilities';"
mysql fg -u fg -pfg -e "DELETE FROM fg_options WHERE option_name LIKE '\\_%';"
mysql fg -u fg -pfg -e "DELETE FROM fg_options WHERE option_name LIKE 'et\\_%';"
mysql fg -u fg -pfg -e "DELETE FROM fg_options WHERE option_name LIKE 'wpseo%';"
mysql fg -u fg -pfg -e "DELETE FROM fg_options WHERE option_name LIKE 'yst%' OR option_name LIKE 'yoast%';"
# safer would be to whitelist options
# TODO sed can messup with serialized arrays.. need to do it from php

-- W nazwie podaj element lub stronę, którego dotyczy uwaga -->

-- Wybierz jeden z szablonów problemów poniżej (inne skasuj) i uzupełnij teksty w nawiasach taki jak ten -->

Szablon 1: Oczekiwałem/am innego działania

Jaką akcję wykonałeś/aś w serwisie?