bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
case class SessionInfo(sessionStartTimestampMs: Long, | |
sessionEndTimestampMs: Long, | |
numEvents: Int) { | |
/** Duration of the session, between the first and last events + session gap */ | |
def durationMs: Long = sessionEndTimestampMs - sessionStartTimestampMs | |
} | |
case class SessionUpdate(id: String, | |
sessionStartTimestampSecs: Long, |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification | |
import tensorflow as tf | |
model_name = 'bert-base-cased' | |
tokenizer = AutoTokenizer.from_pretrained(model_name) | |
model = TFAutoModelForSequenceClassification.from_pretrained(model_name, num_labels=2) | |
texts = ["I'm a positive example!", "I'm a negative example!"] | |
labels = [1, 0] |
poetry run gunicorn testpg:app -p 8080 --preload --reload --reload-engine inotify -w 10 -k uvicorn.workers.UvicornWorker --log-level debug --access-logfile - --error-logfile - --access-logformat "SSSS - %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s"
docker run --network="host" -it --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -e PGDATA=/var/lib/postgresql/data/pgdata -v /tmp/pgdata2:/var/lib/postgresql/data -e POSTGRES_USER=test postgres
This command will quickly start postgres on port 5432 and create a database test with user test and password mysecretpassword
// Found article on https://or.stackexchange.com/questions/529/supply-chain-public-data-repository | |
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176 | |
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176/suppl_file/msom.1070.0176-sm-datainexcel.zip | |
//Article by Sean P. Willems: https://pdfs.semanticscholar.org/232c/451fcf58dbcc1527de6d02cd6e76aea9e871.pdf?_ga=2.33151675.429569592.1581427039-1552162479.1581427039 | |
Table 2 Classifications Used to Label Every Stage in the Chains | |
Classifications label Activity | |
Dist_ A stage that distributes an item | |
Manuf_ A stage that manufactures or assembles an item | |
Part_ A stage that procures an item |
{% macro anonymize(column_name, function, add_alias=True) %} | |
{% if execute %} | |
{% call statement('salt', fetch_result=True) %} | |
select salt from sources.private.salt limit 1; | |
{% endcall %} | |
{% set salt = load_result('salt')['data'][0][0] %} | |
{% if function == 'full_hash' %} | |
SHA256(concat({{ column_name }},'{{ salt }}')) | |
{% endif %} |
#!/usr/bin/env bash | |
PROCESSOR_COUNT=$(nproc) | |
THREAD_COUNT=2 | |
uwsgi --http :9808 --plugin python2 --wsgi-file app.py --processes "$PROCESSOR_COUNT" --threads "$THREAD_COUNT" --disable-logging |
Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw
This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!
It assumes some knowledge of AWS.
{ | |
"Description": "Create a VPC with a SG which references itself", | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Resources": { | |
"vpctester": { | |
"Type": "AWS::EC2::VPC", | |
"Properties": { | |
"CidrBlock": "172.16.0.0/23", | |
"EnableDnsSupport": false, | |
"EnableDnsHostnames": false, |
# NOTE | |
# | |
# | |
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands | |
# | |
#################################################################################################### | |
# Fetch the private IP for resolving DNS dynamically in nginx | |
# We also need to escape the `.` from it for usage in later sed | |
# | |
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'` |