Skip to content

Instantly share code, notes, and snippets.

View DeepInThought's full-sized avatar
🎯
Focusing

DeepInThought

🎯
Focusing
View GitHub Profile
@mschoch
mschoch / elasticsearch-docker-script
Last active November 19, 2022 19:38
A script to fix ownership of Elasticsearch data directory (when mounted as a volume in docker), then switch to elasticsearch user and launch elasticsearch
#!/bin/sh
# fix permissions (wrong if docker mounted volume)
chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
# now switch to elasticsearch user and run in foreground
echo Starting: /usr/share/elasticsearch/bin/elasticsearch -Des.default.config=$CONF_FILE -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=$LOG_DIR -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=$CONF_DIR $@
su elasticsearch -s /bin/sh -c "/usr/share/elasticsearch/bin/elasticsearch -Des.default.config=$CONF_FILE -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=$LOG_DIR -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=$CONF_DIR $@"
##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
@soarez
soarez / ca.md
Last active July 19, 2024 04:05
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@jcavat
jcavat / Dockerfile
Last active July 19, 2024 11:36
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
provider "aws" {
region = "us-east-1"
shared_credentials_file = "~/.aws/credentials"
profile = "${var.aws_profile}"
}
terraform {
backend "s3" {
bucket = "your.bucket.com"
key = "path/to"
#!/usr/bin/env bash
#Find the ip addresses of running instances
# set -f disables file globbing so wthat we can invoke ./list-nodes test1 '*'
# otherwise the star is expanded and messes with the command
set -f
network_name=$1
role=$2
#!/usr/bin/env bash
BUCKET=our.s3.bucket.com
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
docker stop bitcoin
tar --exclude='.lock' --exclude='debug.log' --exclude='peers.dat' --exclude='banlist.dat' -czvf /tmp/bitcoin.tgz /var/bitcoin/
/usr/local/bin/aws s3 cp /tmp/bitcoin.tgz s3://$BUCKET/bitcoin-backups/$DATE/$(hostname)/bitcoin.tgz
docker start bitcoin
#!/usr/bin/env bash
BUCKET=our.s3.bucket.com
FILE=$1
if [[ ! -z "$FILE" ]]; then
/usr/local/bin/aws s3 cp s3://$BUCKET/bitcoin-backups/$FILE /tmp/restore.tgz
else
echo "File not specified, will restore backup we started with (assumed to be in /tmp/bitcoin.tgz)"
cp /tmp/bitcoin.tgz /tmp/restore.tgz
fi
# Save the peers
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
network=$1
filename=$2
if [[ -z "$network" ]]; then
echo "Usage: ./restore-chainstate network [filename]"
echo "Restores chainstate. Example: ./restore-chainstate test1 2018-05-07/bitcoin.tgz"
echo "If filename is omitted, will restore to whatever was in /tmp/bitcoin.tgz, typically what we booted with"
fi
stop_command="btcstop"