When executing Python natively:
$ python pystone.py
Pystone(1.1) time for 50000 passes = 0.129016
This machine benchmarks at 387549 pystones/second
"""Patch to use callbacks with Streamlit custom components. | |
Usage | |
----- | |
>>> import streamlit.components.v1 as components | |
>>> from components_callbacks import register_callback | |
>>> | |
>>> print("Script begins...") | |
>>> |
# namespace to be deleted in k8s | |
NAMESPACE=foo | |
# Terminal 1 | |
kubectl proxy | |
# Terminal 2 | |
kubectl get ns $NAMESPACE -o json | \ | |
jq '.spec.finalizers=[]' | \ | |
curl -X PUT "http://localhost:8001/api/v1/namespaces/${NAMESPACE}/finalize" -H "Content-Type: application/json" --data @- |
const eventFilterv5WithPagination = (contractAddress, erc20abi, _provider, numberOfResponses) => { | |
// creating the interface of the ABI | |
const iface = new ethers.utils.Interface(erc20abi.abi); | |
// intialize array for the logs | |
let logs = []; | |
// get latest block number | |
const latest = await provider.getBlockNumber(); | |
// intialize a counter for which block we're scraping starting at the most recent block | |
let blockNumberIndex = latest; |
const eventFilter = (contractAddress, contractAbi, eventName, _provider) => { | |
const provider = _provider | |
// this will return an array with an object for each event | |
const events = contractAbi.abi.filter(obj => obj.type ? obj.type === "event" : false); | |
// getting the Transfer event and pulling it out of its array | |
const event = events.filter(event => event.name === eventName)[0]; | |
// getting the types for the event signature | |
const types = event.inputs.map(input => input.type) | |
// knowing which types are indexed will be useful later | |
let indexedInputs = []; |
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned. | |
# Docker | |
sudo apt-get update | |
sudo apt-get remove docker docker-engine docker.io | |
sudo apt install docker.io | |
sudo systemctl start docker | |
sudo systemctl enable docker | |
docker --version |
import requests | |
import certifi | |
import sys | |
try: | |
requests.get('https://any-website-protected-by-your-custom-root-ca') | |
print('Certificate already added to the certifi store') | |
sys.exit(0) | |
except requests.exceptions.SSLError as err: | |
print('SSL Error. Adding custom certs to Certifi store...') |
Source: http://www.syahzul.com/2016/04/06/how-to-install-oci8-on-ubuntu-14-04-and-php-5-6/
Download the Oracle Instant Client and SDK from Oracle website. (Need to login in Oracle page)
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
import json | |
import subprocess | |
import sys | |
import os | |
import zipfile | |
def upload_editable_requirement_from_current_venv(sc): | |
for requirement_dir in get_editable_requirements(): | |
add_lib_to_spark_context(requirement_dir, sc) |
import json | |
import subprocess | |
import sys | |
from pex.fetcher import PyPIFetcher | |
from pex.pex_builder import PEXBuilder | |
from pex.resolvable import Resolvable | |
from pex.resolver import resolve_multi, Unsatisfiable, Untranslateable | |
from pex.resolver_options import ResolverOptionsBuilder |