- [Введение в программирование на Go][1]
- [Маленькая книга о Go][3]
- [Эффективный Go][2]
- Есть еще [Краткий пересказ Effective Go на русском языке][4], но 2009 года
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
/* | |
* MIT License | |
* | |
* Copyright (c) 2023 Fabio Lima | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
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
python manage.py shell -c ' | |
from django_redis import get_redis_connection | |
from datahub_core.datetime_utils import datetime_utcnow | |
from ms_tko.models import AccountingPoint | |
client = get_redis_connection("default") | |
counter = 0 | |
chunk_size = 50000 |
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
############################################################################## | |
# | |
# Simple Python program to benchmark several Python Excel writing modules. | |
# | |
# python bench_excel_writers.py [num_rows] [num_cols] | |
# | |
# | |
import sys | |
import resource |
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
import logging | |
from concurrent.futures import ThreadPoolExecutor | |
from datetime import timedelta, datetime | |
from typing import Any, Dict | |
class SimpleStorageEntry: | |
_counter: int = 0 | |
id: int |
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
import asyncio | |
# Ref: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop | |
# > If there is no current event loop set in the current OS thread, | |
# > the OS thread is main, and set_event_loop() has not yet been called, | |
# > asyncio will create a new event loop and set it as the current one | |
loop = asyncio.get_event_loop() | |
# So, loop2 is loop | |
loop2 = asyncio.get_event_loop() |
- Generate TLS certificates for
localhost
:
pip install trustme-cli
trustme-cli
- Run
wrk
on each endpoint, eg:
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
import functools | |
def force_async(fn): | |
''' | |
turns a sync function to async function using threads | |
''' | |
from concurrent.futures import ThreadPoolExecutor | |
import asyncio | |
pool = ThreadPoolExecutor() |
With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.
Note that:
- you shouldn't change the modifier keys mapping with keyboard DIP. This script assumes you use a standard PC keyboard layout, and wish to use shortcuts as if it was a mac keyboard layout.
- To use
cmd + shift + ↑ / ↓ / ← / →
(select text between cursor and top / bottom / beginning of line / end of line), You should disable theBetween input languages
shotcut fromControl Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys
due to conflicting.
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
import asyncpg | |
import ujson | |
class Transaction: | |
def __init__(self, pool): | |
self.pool = pool | |
async def __aenter__(self): | |
self.acquire_context = self.pool.acquire() |
NewerOlder