type Customer {
id: ID!
email: String!
}
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
""" | |
PoC of an equivalent Python implementation of the third solution borrowed from the following video: | |
<https://www.youtube.com/watch?v=_ccDqRTx-JU> | |
Important note: Python static type checkers are independent from the interpreter, and type checking failing | |
does not prevent from running code. Considering that, the following code does NOT perform runtime checks for | |
safety. `add_password()` is still technically accessible, even through a `PasswordManager` object in a locked | |
state (i.e. `PasswordManager[Literal[True]]`). | |
The program also requires the following dependencies: |
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
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.8.0; | |
contract AdversarialRoyalties { | |
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; | |
function supportsInterface(bytes4 interfaceID) external pure returns (bool) { | |
return interfaceID == _INTERFACE_ID_ERC2981; | |
} |
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
pragma solidity ^0.6.0; | |
///#invariant unchecked_sum(_balances) == _totalSupply; | |
///#if_succeeds unchecked_sum(_balances) == old(unchecked_sum(_balances)) || msg.sig == bytes4(0x00000000); | |
contract AnnotatedToken { | |
uint256 private _totalSupply; | |
mapping (address => uint256) private _balances; | |
mapping (address => mapping (address => uint256)) private _allowances; | |
constructor() public { |
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 inspect | |
from functools import partial, wraps | |
from typing import Union | |
from app import schemas | |
from app.db import database | |
from pydantic.main import ModelMetaclass | |
from shortuuid import uuid | |
# The following 2 functions parse raw results from the SQL queries |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: jupyterlab | |
namespace: jlab | |
labels: | |
name: jupyterlab | |
spec: | |
replicas: 1 | |
selector: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# authenticate | |
from google.colab import auth | |
auth.authenticate_user() | |
import gspread | |
from oauth2client.client import GoogleCredentials as GC | |
gc = gspread.authorize(GC.get_application_default()) | |
# create, and save df | |
from gspread_dataframe import set_with_dataframe | |
title = 'New Sheet' | |
gc.create(title) # if not exist |
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
# https://hakibenita.com/fast-load-data-python-postgresql | |
from typing import Iterator, Dict, Any, Optional | |
from urllib.parse import urlencode | |
import datetime | |
#------------------------ Profile | |
import time |
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
/* requires AWS creds to be updated. | |
* if they aren't, update using AWS.config.update() method before instatiing the client. | |
* | |
* import this module where you instantiate the client, and simply pass this module as the connection class. | |
* | |
* eg: | |
* const client = new Client({ | |
* node, | |
* Connection: AwsConnector | |
* }); |
NewerOlder