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 randint | |
def find_components(raw_array, value): | |
""" | |
~O(n) find first combination in `new_array` which sum equal `value`. | |
""" | |
# remove from array all values grand then needed value | |
array = list(filter(lambda x: x <= value, raw_array)) | |
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
#! coding:utf-8 | |
from libqtile.config import Key, Screen, Group, Drag, Click | |
from libqtile.command import lazy | |
from libqtile import layout, bar, widget | |
mod = "mod4" | |
keys = [ | |
Key( | |
[mod], "k", |
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
bundle_id = 'gogoyuedu.book.job.news.learn.read' | |
api_key = 'Alkene-608a20735120.json' | |
validator = GooglePlayVerifier(bundle_id, api_key) | |
try: | |
validation_result = validator.verify(purchase_json['token'], sub_code, is_subscription=True) | |
except errors.GoogleError as exc: | |
logging.error('Purchase validation failed {}'.format(exc)) |
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 uvicorn | |
from aioredis import create_pool | |
from fastapi import FastAPI | |
from starlette.websockets import WebSocket | |
app = FastAPI() | |
REDIS_URL = 'redis://redis:6379' | |
REDIS_DB = 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
using System; | |
namespace Oneman.DI | |
{ | |
[AttributeUsage(AttributeTargets.Field)] | |
public class Inject: Attribute {} | |
} |
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
using UnityEngine; | |
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using Cysharp.Threading.Tasks; | |
using Oneman.DI; | |
using Object = UnityEngine.Object; | |
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
class ExampleButtonMapper: TeseBehaviour { | |
[Inject] public NetworkManager NetworkManager; | |
[Inject] public ProfileManager ProfileManager; | |
[Inject] public SoundManager SoundManager; | |
[Inject] public WindowManager WindowManager; | |
public async void _OnButton() | |
{ | |
if (ProfileManager.HasResourcesToUpgrade()) { | |
SoundManager.PlayButtonSound(); |
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 MATERIALIZED VIEW example.parsed | |
( | |
`event_uuid` String, | |
`datetime` DateTime, | |
`a` Int32, | |
`b` Int32, | |
`c` Int32, | |
`d` Float64, | |
`e` Float64, | |
`f` Float64, |