HTTP Method | URI | Action |
---|---|---|
GET | http://[hostname]/activity/api/v1/users | Retrive list of available users |
GET | http://[hostname]/activity/api/v1/users/[user_id] | Retrive a user's activity for the current day |
GET | http://[hostname]/activity/api/v1/users/[user_id]?date=dd-mm-yyyy | Retrive a user's activity for the specified day |
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
[ | |
{ | |
"name": "Top Level", | |
"parent": "null", | |
"children": [ | |
{ | |
"name": "Level 2: A", | |
"parent": "Top Level", | |
"children": [ | |
{ |
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
select | |
blocked_locks.pid as blocked_pid, | |
blocked_activity.usename as blocked_user, | |
blocked_activity.datname as database, | |
blocking_locks.pid as blocking_pid, | |
blocking_activity.usename as blocking_user, | |
blocked_activity.query as blocked_statement, | |
blocking_activity.query as blocking_statement | |
from pg_catalog.pg_locks blocked_locks | |
join pg_catalog.pg_stat_activity blocked_activity |
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
create table test | |
( | |
name character varying(20), | |
id character varying(20) not null | |
); | |
insert into test (name, id) values ('bar', ''); | |
insert into test (name, id) values ('foo', '11'); | |
insert into test (name, id) values ('foo', '22'); |
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
-- SQL comes from here | |
-- https://momjian.us/main/writings/pgsql/locking.pdf | |
-- cannot be a temporary view because other sessions must see it | |
create view lockview as | |
select | |
pid, | |
virtualtransaction as vxid, | |
locktype as lock_type, | |
mode as lock_mode, |
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
-- https://devcenter.heroku.com/articles/dynos | |
-- export DATABASE_URL=postgres://python:python@localhost:5432/python_db | |
-- alter timezone on a dyno | |
-- heroku config:add TZ=Europe/Moscow | |
-- alter timezone on a database | |
alter role uaclvvcazghplm set timezone = 'Europe/Moscow'; |
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
create or replace function parsetid(tid) returns text as $$ | |
select (regexp_matches($1::text, '\((\d+),\d+\)'::text))[1]; | |
$$ language sql immutable strict; | |
create or replace function getgraph(idxname text) returns text as $$ | |
declare | |
nblocks bigint; | |
blkno bigint; | |
i bigint; | |
t text; |
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
----- Esc ----- | |
Quick change directory: Esc + c | |
Quick change directory history: Esc + c and then Esc + h | |
Quick change directory previous entry: Esc + c and then Esc + p | |
Command line history: Esc + h | |
Command line previous command: Esc + p | |
View change: Esc + t (each time you do this shortcut a new directory view will appear) | |
Print current working directory in command line: Esc + a | |
Switch between background command line and MC: Ctrl + o | |
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name |
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 random import sample | |
class Cell: | |
BOMB = 'B' | |
FLAG = 'F' | |
def __init__(self): | |
self.status = 0 | |
self.content = 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
# Token types | |
# EOF (end-of-file) token is used to indicate that | |
# there is no more input left for lexical analysis | |
INTEGER, PLUS, MINUS, MUL, DIV, EOF = 'INTEGER', 'PLUS', 'MINUS', 'MUL', 'DIV', 'EOF' | |
class Token(object): | |
def __init__(self, type, value): | |
# token type: INTEGER, PLUS, MINUS, or EOF | |
self.type = type |