I hereby claim:
- I am grimen on github.
- I am grimen (https://keybase.io/grimen) on keybase.
- I have a public key ASDYRda1WeMQI2Jdsy5OLP9yInKsYJnkXD0NcYVOCxh07wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| def truncate_db(engine): | |
| # delete all table data (but keep tables) | |
| # we do cleanup before test 'cause if previous test errored, | |
| # DB can contain dust | |
| meta = MetaData(bind=engine, reflect=True) | |
| con = engine.connect() | |
| trans = con.begin() | |
| con.execute('SET FOREIGN_KEY_CHECKS = 0;') | |
| for table in meta.sorted_tables: | |
| con.execute(table.delete()) |
| # @source: https://medium.com/@DorIndivo/how-we-migrated-from-python-multithreading-to-asyncio-128b0c8e4ec5 | |
| async def run_func_async(func:Callable, func_args:List[Any], executor:ThreadPoolExecutor): | |
| if asyncio.iscoroutinefunction(func): | |
| return await func(*func_args) | |
| else: | |
| return await asyncio.get_event_loop().run_in_executor( | |
| func=lambda:func(*func_args), executor=executor) |
| const { defineAbility } = require('@casl/ability'); | |
| const { rulesToQuery } = require('@casl/ability/extra'); | |
| const Knex = require('knex'); | |
| const { Model } = require('objection'); | |
| const { interpret } = require('@ucast/objection') | |
| const { CompoundCondition } = require('@ucast/core') | |
| const knex = Knex({ | |
| client: 'sqlite3', | |
| connection: ':memory:' |
| /* ========================================= | |
| IMPORTS | |
| -------------------------------------- */ | |
| const fs = require('fs') | |
| const path = require('path') | |
| const _yaml = require('js-yaml') |
| sudo rmmod nvidia_uvm | |
| sudo rmmod nvidia | |
| sudo modprobe nvidia | |
| sudo modprobe nvidia_uvm |
| const createFor = (exported = {}) => { | |
| return (defaults = {}) => { | |
| const functions = {} | |
| exported['defaults'] = {...defaults} | |
| for (const [key, value] of Object.entries(exported)) { | |
| if (typeof value === 'function') { | |
| functions[key] = exported[key] |
| class CombinedStream extends stream.PassThrough { | |
| constructor (...streams) { | |
| super() | |
| this._streams = streams | |
| this._transformStream = undefined | |
| this.on('pipe', this.onPipe) | |
| } |
| /* ========================================= | |
| IMPORTS | |
| -------------------------------------- */ | |
| const fs = require('fs') | |
| const { promisify } = require('util') | |
| sleep = promisify(setTimeout) |
| /* ============================================= | |
| Dependencies | |
| ------------------------------------------ */ | |
| const debug = require('debug') | |
| const chalk = require('chalk') | |
| const { Readable, Writable, Transform, pipeline } = require('stream') |