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 random import randint, shuffle | |
from typing import List, Dict | |
PEOPLE = ['ADI', 'MOR', 'GUY', 'NOY'] | |
def main(names: List[str]) -> Dict[str, str]: | |
length = len(names) | |
gamad_anak = {} | |
while len(gamad_anak) != length: |
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
# install docker if not exists | |
if [ ! -x "$(command -v docker)" ]; then | |
echo "Install docker prerequisites" | |
sudo apt-get update | |
sudo apt-get install \ | |
apt-transport-https -y \ | |
ca-certificates -y \ | |
curl -y \ | |
gnupg-agent -y \ |
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 sqlalchemy.dialects import postgresql; | |
print(query.statement.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})) |
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 io import StringIO | |
import csv | |
TEMP_TABLE = 'temp_table' | |
def psql_insert_copy(table, conn, keys, data_iter, on_conflict_ignore=False): | |
# gets a DBAPI connection that can provide a cursor | |
dbapi_conn = conn.connection | |
with dbapi_conn.cursor() as cur: |
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
class display: | |
"""Display HTML representation of multiple objects""" | |
template = """<div style="float: left; padding: 10px;"> | |
<p style='font-family:"Courier New", Courier, monospace'>{0}</p>{1} | |
</div>""" | |
def __init__(self, *args, **kwargs): | |
self.args = args | |
self.kwargs = kwargs | |
def _repr_html_(self): |