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
#! /bin/bash | |
set -o errexit | |
set -o nounset | |
set -o xtrace | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list | |
sudo apt update |
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
# Start SSH agent | |
eval $(ssh-agent) | |
# Add specific key | |
ssh-add ~/.ssh/butterfly.pem | |
# Add default key (if needed for GitHub, etc) | |
ssh-add | |
# SSH config entries |
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 os | |
import time | |
import pathlib | |
import tarfile | |
import tempfile | |
import torch | |
PROJECT_PATH = pathlib.Path(os.environ.get("PROJECT_PATH", ".")) |
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
"""Elasticsearch backend that enables fuzzy search to all plaintext queries.""" | |
from wagtail.search.backends.elasticsearch6 import (Elasticsearch6SearchBackend, | |
Elasticsearch6SearchQueryCompiler) | |
class ElasticsearchQueryCompilerWithFuzziness(Elasticsearch6SearchQueryCompiler): | |
""" | |
Copy of Elasticsearch6SearchQueryCompiler class with a modified default query. | |
Adds the "fuzziness" parameter to all queries so that we can return inexact | |
matches for misspellings, etc. |
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
worker_processes auto; | |
rtmp_auto_push on; | |
events {} | |
rtmp { | |
server { | |
listen 1935; | |
listen [::]:1935 ipv6only=on; | |
application live { | |
live on; |
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
def add_child_page(parent_page, instance): | |
""" | |
Mimic the behavior of the "add_child" from Django treebeard. | |
We can't use `parent_page.add_child(instance=child_page)` inside of | |
migrations because historical models don't have access to class | |
methods. This replicates the behavior of `add_child` by calculating | |
the treebeard path, path depth and url path. | |
https://django-treebeard.readthedocs.io/en/latest/api.html#treebeard.models.Node.add_child |
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://craftcms.stackexchange.com/questions/13584/devmode-phpdotenv-variable-ignored | |
'devMode' => filter_var(getenv('DEV_MODE') ?: false, FILTER_VALIDATE_BOOLEAN), |
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
#! /usr/bin/env bash | |
# Install the SciPy stack on Amazon Linux and prepare it for AWS Lambda | |
yum -y update | |
yum -y groupinstall "Development Tools" | |
yum -y install blas --enablerepo=epel | |
yum -y install lapack --enablerepo=epel | |
yum -y install atlas-sse3-devel --enablerepo=epel | |
yum -y install Cython --enablerepo=epel |
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
HSPD=20000 | |
LSPD=1000 | |
ACC=300 | |
DEC=300 | |
EO=3 | |
WHILE 1 = 1 | |
X50000 | |
Y50000 | |
WAITX | |
WAITY |
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
#! /usr/bin/env python3 | |
import json | |
import boto3 | |
import argparse | |
import time | |
lambda_client = boto3.client('lambda') | |
function_choices = [f['FunctionName'] for f in lambda_client.list_functions()['Functions']] |