Skip to content

Instantly share code, notes, and snippets.

View Spechal's full-sized avatar

Travis Crowder Spechal

  • Keyboard Jockey
  • Kansas City
  • 11:06 (UTC -06:00)
View GitHub Profile
@Spechal
Spechal / bash_aws_jq_cheatsheet.sh
Created May 17, 2019 04:09 — forked from lukeplausin/bash_aws_jq_cheatsheet.sh
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@Spechal
Spechal / knife.rb
Created April 9, 2019 18:46 — forked from jtimberman/knife.rb
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
@Spechal
Spechal / 1. Install python3.6 & pip3.md
Created October 23, 2018 00:46 — forked from alyssaq/1. Install python3.7 & pip3.md
Python3.6 setup on Mac 10.13 (High Sierra)
  1. Install Python 3.6.x from https://www.python.org/downloads/ or via homebrew.
$ brew install python3   # Installed at /usr/local/Cellar/python3

Check that python3 has been installed by running it at the terminal:

$ python3
>>> Python 3.6.5
  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and install (this should already be installed if python was installed from python.org or homebrew):
@Spechal
Spechal / osx_install.sh
Created August 17, 2018 15:58 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@Spechal
Spechal / 1_kubernetes_on_macOS.md
Created August 6, 2018 20:57 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

ChefDK, Test Kitchen Driven NTP Cookbook

This gist uses TK+Berkshelf to drive creating a vagrant virts and converging a simple recipe to install and configure NTPd. This is a simple cookbook that has one recipe, one template (for ntp.conf) and one attribute file. It works on Ubuntu 12.04 and CentOS 6.4 (and derviatives) and the attribute file is used to support both distros.

This should work on Mac (where I developed it) and any chef-supported Linux that you can get Vagrant onto (Ubuntu/CentOS).

Because I use ChefDK and Test Kitchen, I can largely ignore setting up Vagrant and Berkshelf and can get right to work on writing recipe code.

NOTE: Modern (7/6/2014) Recipe Generation

$ HOMEBREW_MAKE_JOBS=1 brew install -v squid 2>&1
==> Downloading http://www.squid-cache.org/Versions/v3/3.3/squid-3.3.10.tar.gz
Already downloaded: /Library/Caches/Homebrew/squid-3.3.10.tar.gz
tar xf /Library/Caches/Homebrew/squid-3.3.10.tar.gz
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/squid/3.3.10 --localstatedir=/usr/local/var --enable-ssl --enable-ssl-crtd --disable-eui --enable-ipfw-transparent
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... cfgaux/install-sh -c -d
checking for gawk... no
checking for mawk... no
[root@server svn-conv]# git svn clone --no-minimize-url --no-metadata -A /home/me/authors-transform.txt -T trunk -b branches -t tags "svn+ssh://jenkins@server/svn/edge/Internal - EDGE - PDFs" Internal-EDGE-PDFs.git
Initialized empty Git repository in /root/svn-conv/Internal-EDGE-PDFs.git/.git/
jenkins@server's password:
W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/Internal - EDGE - PDFs'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
[root@server svn-conv]# cd Internal-EDGE-PDFs.git/
[root@server Internal-EDGE-PDFs.git]# ls alh
ls: cannot access alh: No such file or directory
[root@server Internal-EDGE-PDFs.git]# ls -alh
[root@server ~]# git svn clone --no-minimize-url --no-metadata -A /home/me/authors-transform.txt "svn+ssh://jenkins@server/svn/edge/project" project.git
... checking out ...
[root@server ~]# cd project.git
[root@server project.git]# ls -alh
total 24K
drwxrwxr-x 6 root root 4.0K Jul 31 10:34 .
drwxrwxr-x 3 root root 4.0K Jul 31 10:33 ..
drwxrwxr-x 4 root root 4.0K Jul 31 10:34 branches
Route::controller('login', 'LoginController');
Route::post('login', array('before' => 'csrf', 'LoginController@postIndex'));
Error:
call_user_func_array() expects parameter 1 to be a valid callback, no array or string given
open: /laravel/bootstrap/compiled.php
$this->callAfterFilters($request, $response);
}
return $response;
}