These are steps to restore an elasticsearch snapshot from one machine to another
Copy zip of snapshot from s3
sudo mkdir /data
# list latest 10 event names and the next token | |
aws cloudtrail lookup-events \ | |
--max-items 10 \ | |
--lookup-attributes AttributeKey=EventSource,AttributeValue=ec2.amazonaws.com \ | |
--lookup-attributes AttributeKey=ReadOnly,AttributeValue=false \ | |
--starting-token "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0=" | \ | |
jq '.Events[].EventName,.NextToken' | |
"ModifyInstanceAttribute" |
Generating a graphviz dot file equivalent to the mol file of pred(3)
in chemlambda v2: pred_3.mol (original name was erroneous)
The lambda calculus expression for pred(3)
(predecessor(3) == 2
) is PRED := λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)
(ref wikipedia)
Writing the above expression as nodes in a graph leads to the below graph. The corresponding dot file was written manually and available further below in this gist. An annotated version of pred_3.mol
to help compare it to pred_3.dot
is available further below in this gist.
To generate the dot file automatically from lambda terms, check http://www.teamshadi.net/chemlambda-js/ (a fork from this jsfiddle ). Its current output for pred(3)
matches with the manually specified graph below.
Version 4 (2019-04-11): shifted indeces back by 1 (e.g. L1 to L0) t
The below is an ackermann function implementation in awk based on the one on rosettacode.org and modified for higher verbosity to illustrate the details of calculations behind the ackermann function's recursion.
For example, the following shows Ackermann(2,2)
> awk -v m=2 -v n=2 -f ackermann_illustrated.awk
Deprecated in favor of https://github.com/shadiakiki1986/dbxcli-sync
license: gpl-3.0 | |
height: 600 |
These are my notes while installing jupyterhub on an AWS EC2 instance running Ubuntu 16.04
Prerequisites
sudo apt-get update && sudo apt-get install python3 python3-pip
- ~~~`pip3 install pew`~~~
# Fiddle at | |
# https://pyfiddle.io/fiddle/a14865cf-38c9-48d6-b90a-f5bedc7a5b6e/?m=Saved%20fiddle | |
# | |
# reshape a matrix M x N into M x P x (N-P) while creating overlapping rows | |
# Useful for LSTM input | |
import numpy as np | |
import pandas as pd | |
def stride_group(group, lahead): |
My first shot at fixing this was in tasks.py file below.
But then that just gave a "unhandled error in deferred", so I went on to use CrawlRunner.
That showed no output at all anymore, and didn't run as expected.
Eventually, I just settled on CELERY_WORKER_MAX_TASKS_PER_CHILD=1=1
in settings.py
Note: CELERY_WORKER_MAX_TASKS_PER_CHILD=1
is for django. Celery without django probably drops the CELERY_
prefix