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
| Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, deep, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnupl |
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 concurrent.futures import ThreadPoolExecutor, Executor, Future | |
| class Promise: | |
| def __init__(self, fn, *args, **kwargs): | |
| self.fn = fn | |
| self.callbacks = [] | |
| self.last_result = None | |
| self.executor: Executor = ThreadPoolExecutor(max_workers=1) | |
| self.future: Future = self.executor.submit(fn, *args, **kwargs) |
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
| # configuration params are copied from @artgor kernel: | |
| # https://www.kaggle.com/artgor/brute-force-feature-engineering | |
| LGB_PARAMS = { | |
| 'objective': 'regression', | |
| 'metric': 'mae', | |
| 'verbosity': -1, | |
| 'boosting_type': 'gbdt', | |
| 'learning_rate': 0.2, | |
| 'num_leaves': 128, | |
| 'min_child_samples': 79, |
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
| import asyncio | |
| import logging | |
| import signal | |
| logger = logging.getLogger(__name__) | |
| class EventLoop: | |
| def __init__(self, loop=None, debug=False): | |
| self.loop = loop or asyncio.get_event_loop() |
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
| # Run a docker registry | |
| # https://docs.docker.com/registry/deploying/ | |
| docker run -d -p 5000:5000 \ | |
| --restart=always \ | |
| --name registry\ | |
| -v /mnt/registry:/var/lib/registry \ | |
| -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 \ | |
| registry:2 | |
| # Add private registry as insecure |
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
| import { mode } from '@chakra-ui/theme-tools'; | |
| import { extendTheme } from '@chakra-ui/core'; | |
| const styles = { | |
| global: props => ({ | |
| ":root": { | |
| "--app-title-color": "#718096", | |
| "--card-minw": "160px", | |
| "--blackwhite": mode("black", "white")(props), | |
| "--whiteblack": mode("white", "black")(props), |
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
| <form | |
| ref={formRef} | |
| onSubmit={(e: React.SyntheticEvent) => { | |
| e.preventDefault(); | |
| const target = e.target as typeof e.target & { | |
| email: { value: string }; | |
| password: { value: string }; | |
| }; | |
| const email = target.email.value; // typechecks! | |
| const password = target.password.value; // typechecks! |
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
| .catch((err: Error | AxiosError) { | |
| if (axios.isAxiosError(error)) { | |
| // Access to config, request, and response | |
| } else { | |
| // Just a stock error | |
| } | |
| }) |
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
| function getCurrentDateP(mongoConnection) { | |
| const query = { _id: 1 }; | |
| const update = { $currentDate: { updated_at: true } }; | |
| const queryOptions = { upsert: true, returnOriginal: false }; | |
| return mongoConnection | |
| .collection('current_date') | |
| .findOneAndUpdate(query, update, queryOptions) | |
| .then(mongoResult => mongoResult.value.updated_at) | |
| } |
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
| Cypress.Commands.add('interceptOnce', (method, path, alias, status) => { | |
| cy.intercept({ | |
| method, | |
| path, | |
| times: 1, | |
| }).as(alias); | |
| if (status) { | |
| return cy.wrap(() => | |
| cy |