Skip to content

Instantly share code, notes, and snippets.

View DeepInThought's full-sized avatar
🎯
Focusing

DeepInThought

🎯
Focusing
View GitHub Profile
@DeepInThought
DeepInThought / elasticsearch-docker-script
Last active May 5, 2019 12:56 — forked from mschoch/elasticsearch-docker-script
Elasticsearch Permission Fix
#!/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 $@"
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"
#! /bin/bash
# This script runs on os x.
SITES=( "speedtest-lon1.digitalocean.com" \
"speedtest-sfo1.digitalocean.com" \
"speedtest-ams1.digitalocean.com" \
"speedtest-ams2.digitalocean.com" \
"speedtest-nyc1.digitalocean.com" \
"speedtest-nyc2.digitalocean.com" \
@DeepInThought
DeepInThought / attributes.rb
Created April 20, 2019 09:40 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
// Set your variables below
SHEET_NAME="MC-Import-Data"
URL="https://coinmarketcap.com/currencies/views/all/"

// Create a trigger to refresh every 5 minutes
function myFunctionA() {
  ScriptApp.newTrigger("getData")
  .timeBased()
 .everyMinutes(5)
@DeepInThought
DeepInThought / clone.sh
Created May 30, 2019 09:43 — forked from syntaqx/clone.sh
Clone all of the projects for a given user or organization.
#!/bin/bash
# Simple helper script that iterates over available repositories and clones them down.
# I know it could use some work.
export USER=syntaqx
curl -u $GITHUB_TOKEN:x-oauth-basic 'https://api.github.com/orgs/$USER/repos?per_page=100' | jq '.[].ssh_url' -r | while read url; do git clone "$url"; done
@DeepInThought
DeepInThought / 0.12.0.tf
Created May 30, 2019 09:44 — forked from syntaqx/0.12.0.tf
Terraform v0.12.0 Using variables dynamically in resources hack until we get for_each. Only works for sets of 2 as implemented.
variable "nodes" {
type = map(object({
size = string
count = number
}))
default = {
manager = {
size = "s-1vcpu-1gb"
count = 1
}
@DeepInThought
DeepInThought / box-sizing.css
Created May 30, 2019 09:44 — forked from syntaqx/box-sizing.css
Useful Bootstrap Snippets
*,
::after,
::before {
box-sizing: border-box
}
@DeepInThought
DeepInThought / 1.swarm-api.service
Created May 30, 2019 09:44 — forked from syntaqx/1.swarm-api.service
Interfacing with systemd for a basic binary service.
[Unit]
Description=A dead simple REST API for Docker Swarm
Documentation=https://github.com/syntaqx/swarm-api
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=5s
Environment=PORT=8080
@DeepInThought
DeepInThought / shlib.sh
Created May 30, 2019 09:45 — forked from syntaqx/shlib.sh
shlib function easily downloadable gist
#!/bin/bash
set -e
cat /dev/null <<EOF
------------------------------------------------------------------------
https://github.com/client9/shlib - portable posix shell functions
Public domain - http://unlicense.org
https://github.com/client9/shlib/blob/master/LICENSE.md
but credit (and pull requests) appreciated.
------------------------------------------------------------------------