This file contains hidden or 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
date | last_activity | |
---|---|---|
2021-11-03 07:39:14 | 160 | |
2021-11-03 07:39:44 | 1594 | |
2021-11-03 07:57:15 | 4270 | |
2021-11-03 07:57:45 | 23201 | |
2021-11-03 07:58:15 | 7 | |
2021-11-03 07:58:45 | 1015 | |
2021-11-03 07:59:15 | 2 | |
2021-11-03 07:59:45 | 3496 | |
2021-11-03 08:28:16 | 6093 |
This file contains hidden or 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
"""Activity monitor""" | |
import os | |
import time | |
import sys | |
from pathlib import Path | |
import datetime | |
import requests | |
import xprintidle # pip install xprintidle |
This file contains hidden or 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
openapi: 3.0.3 | |
info: | |
title: Cashlink API | |
version: 2.3.0 | |
description: External Distribution API | |
contact: | |
email: [email protected] | |
paths: | |
/v2/investors/: | |
post: |
This file contains hidden or 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
start transaction isolation level read committed; | |
SELECT * FROM balances ORDER BY id; | |
id | balance | |
-------+--------- | |
Alice | 500 | |
Bob | 500 | |
(2 rows) | |
UPDATE balances SET balance = 100 WHERE id = 'Bob'; |
This file contains hidden or 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
start transaction isolation level read committed; | |
SELECT * FROM balances; | |
id | balance | |
-------+--------- | |
Alice | 500 | |
Bob | 500 | |
(2 rows) | |
INSERT INTO | |
balances |
This file contains hidden or 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
# UPDATE balances SET balance = 500; | |
UPDATE 2 | |
# start transaction isolation level repeatable read; | |
START TRANSACTION | |
# SELECT SUM(balance) | |
FROM balances | |
WHERE id in ('Alice', 'Bob'); | |
sum | |
------ |
This file contains hidden or 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
-- Transaction 2 Transaction 1 | |
# UPDATE balances SET balance = 500; | |
UPDATE 2 | |
# start transaction isolation level read committed; | |
START TRANSACTION | |
# SELECT SUM(balance) | |
FROM balances | |
WHERE id in ('Alice', 'Bob'); | |
sum |
This file contains hidden or 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 | |
transfer_out(source VARCHAR, amount INT) RETURNS void AS $$ | |
DECLARE | |
source_balance_after int; | |
BEGIN | |
UPDATE balances SET balance = balance - amount WHERE id = source; | |
SELECT balance FROM balances WHERE id = source INTO source_balance_after; | |
IF source_balance_after < 0 THEN | |
RAISE EXCEPTION 'Account % does not have enough money', source; | |
END IF; |
This file contains hidden or 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 typing import Tuple, List | |
def solution(l: List[int], t: int) -> Tuple[int, int]: | |
""" | |
>>> solution([1, 2, 3, 4, 5], 3) | |
(0, 1) | |
>>> solution([1, 2, 3, 4, 5], 4) | |
(3, 3) | |
>>> solution([1, 2, 3, 4, 5], 9) |
This file contains hidden or 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
match command.split(): | |
case ["quit"]: | |
print("Goodbye!") | |
quit_game() | |
case ["look"]: | |
current_room.describe() | |
case ["get", obj]: | |
character.get(obj, current_room) | |
case ["go", direction]: | |
current_room = current_room.neighbor(direction) |