Skip to content

Instantly share code, notes, and snippets.

View kevashcraft's full-sized avatar

Kevin Ashcraft kevashcraft

View GitHub Profile
@kevashcraft
kevashcraft / keybase.md
Last active August 29, 2015 13:57
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am kevashcraft on github.
  • I am kevashcraft (https://keybase.io/kevashcraft) on keybase.
  • I have a public key whose fingerprint is 750B 82DF 2D84 EF12 8505 9A03 902F 0D8A 791D C126

To claim this, I am signing this object:

@kevashcraft
kevashcraft / addsite
Last active June 20, 2017 16:38
Create a WordPress Site with WP CLI
#!/bin/bash
#
# addsite
# a bash script to create a new directory, download wordpress, create the database and user, and create wp-config and the initial site install with wp cli
# by Kevin Ashcraft (@kevashcraft)
# last updated on November, 8th 2014
#
# * expects a template file at /etc/nginx/conf.d/template
# * expects wp cli executable as wp
# * expects that this is not really just a dream
@kevashcraft
kevashcraft / daily_backup
Last active December 2, 2018 22:43
Recursive backup w rsync - bash script
#!/bin/bash
DESTINATION="/Backup"
SOURCE="/var/www"
#Todays date in ISO-8601 format:
DAY0=`date -I`
#Previous backup date:
@kevashcraft
kevashcraft / script.js
Created July 24, 2015 00:12
Paper Dialog AutoFocus and Size Fix
window.addEventListener('iron-overlay-opened', fixDialog);
function fixDialog (dore) {
var dialog = (typeof dore.tagName != 'undefined') ? dore : dore.target;
if(dialog.tagName == 'PAPER-DIALOG') {
dialog.fit();
var input = dialog.querySelector('[autofocus]');
if(input) {
if(typeof input.dataset.highlight != 'undefined') var highlight = true;
switch(input.tagName.toLowerCase()) {
fileUpload: function(e,d,o) {
if(this.$.upfile.value == null) return;
this.fileUploading = true;
var formData = new FormData();
formData.append('upfile', this.$.upfile.files[0], this.$.upfile.value );
formData.append('proposal', this.proposal.id);
var xhr = new XMLHttpRequest();
xhr.open('POST', '/jaxson/proposals/file_upload?token=' + BPC.user.token, true);
xhr.onload = function(e) {
@kevashcraft
kevashcraft / backup
Created March 16, 2016 16:03
Kevin's Bash Backup Program
#!/bin/bash
# Kevin's BASH Backup Program
# - runs every $interval
# - at midnight moves most recent to daily folder
# - on first day of the week moves most recent to weekly folder
# - on first day of the month moves most recent to monthly folder
# - deletes oldest interval backups after $keepinterval
@kevashcraft
kevashcraft / docker-compose-coreos
Last active January 19, 2018 15:21
Docker Compose Run as Container
docker run \
-it \
-v $(pwd):/config \
-v /var/run/docker.sock:/var/run/docker.sock \
docker/compose:1.18.0 \
-f /config/docker-compose.yml up
@kevashcraft
kevashcraft / 00-WordPress-on-CoreOS.md
Last active January 19, 2018 17:15
Setup WordPress with Docker-Compose on CoreOS

Setup WordPress with Docker-Compose on CoreOS

Setup Steps

  1. Create docker-compose.yml in /home/core/, replacing the $variables with your values
  2. Create nginx.tmpl in /var/lib/docker/volumes/wpserver_nginx_templates/_data/
  3. Create wp-server.service in /etc/systemd/system/
  4. Run sudo systemctl daemon-reload to load the new service file
  5. Run sudo systemctl start wp-server to start the WordPress Server
  6. Run sudo systemctl status wp-server to make sure everything is running
@kevashcraft
kevashcraft / K8s-DigitalOcean-CoreOS.md
Last active September 18, 2020 05:47
How to Setup Kubernetes on DigitalOcean with CoreOS

Kubernetes on DigitalOcean with CoreOS

Let's look at an example of how to launch a Kubernetes cluster from scratch on DigitalOcean, including kubeadm, an Nginx Ingress controller, and Letsencrypt certificates.

Overview

Environment

We'll be creating a four-node cluster (k8s-master, k8s-000...k8s-002), load balancer, and ssl certificates.

Table of Contents

  1. Install Kubernetes
@kevashcraft
kevashcraft / retrieve.py
Created June 18, 2018 17:18
Retrieve Stock Market Data from the AlphaVantage API
from urllib.request import urlopen
import yaml
def retrieve(symbol=None):
with open('config.yml') as f:
config = yaml.load(f)
params = {
'function': 'TIME_SERIES_DAILY',
'symbol': symbol,