Skip to content

Instantly share code, notes, and snippets.

View ryanmaclean's full-sized avatar
🍩
Running tf apply 💜

Ryan MacLean ryanmaclean

🍩
Running tf apply 💜
View GitHub Profile
@ryanmaclean
ryanmaclean / remove_stopped_dockers.sh
Created April 10, 2016 22:48
Remove all stopped Docker Containers
#!/bin/bash
docker rm $(docker ps -a | sed '1d' | awk '{print $1}')
@ryanmaclean
ryanmaclean / delete_all_docker_images.sh
Created April 10, 2016 22:44
Forcefully Delete All Local Docker Images
#!/bin/bash
docker rmi -f $(docker images | sed '1d' | awk '{print $3}')
@ryanmaclean
ryanmaclean / cat_eof_es_example.sh
Last active May 6, 2016 22:54
Cat EOF (Here File) for Elasticsearch Config File
#!/bin/bash
cat >> /etc/elasticsearch/elasticsearch.yml << EOF
cluster.name: ELASTICAWESOME
cloud.aws.access_key: ACCESS_KEY_HERE
cloud.aws.secret_key: SECRET_KEY_HERE
cloud.aws.region: us-east-1
discovery.type: ec2
discovery.ec2.tag.Name: "ELKBEE"
http.cors.enabled: true
http.cors.allow-origin: "*"
@ryanmaclean
ryanmaclean / logitech_custom_buttons_ubuntu.md
Last active January 23, 2024 07:58
Change Logitech Mouse Button Keys in Ubuntu Vivid

Change Logitech Mouse Buttons in Ubuntu

Dependencies

We'll need to install xbindtools and xev prior to configuring our mouse buttons:

sudo apt-get install xev xbindtools
@ryanmaclean
ryanmaclean / match_non_whitespace.md
Last active January 11, 2016 21:38
Regex: Match all but Space Character

Regex to Match All Characters Except Spaces

[^\s]+
@ryanmaclean
ryanmaclean / kitematic_elasticsearch_logstash_kibana_syslog.md
Last active May 16, 2019 14:27
Docker Kitematic ELK Syslog Setup for Mac Logs

Docker Kitematic ELK Syslog Setup for Mac Logs

First install docker-toolbox on your Mac:

brew install docker-toolbox

Start Kitematic

open /Applications/Docker/Kitematic\ \(Beta\).app
@ryanmaclean
ryanmaclean / coreos_xhyve.md
Last active December 27, 2015 21:31
CoreOS Cluster with Xhyve on OSX Hosts

CoreOS Cluster on Many Macs using Xhyve

As a holiday project, I thought I'd try my hand at using xhyve on OSX instead of the more established Vagrant CoreOS Cluster set up as it has less overhead.

Xhyve is a port of the BSD package bhyve virtualization platform that is the default for FreeBSD 10 and up. There's a great section in the BSD about bhyve here: https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html

A couple problems arose, mostly because I was unfamiliar with the xhyve and its use of TAP adapters on OSX, but regardless, I think the expirement was a great learning process and wanted to share with others.

Note: you'll need OSX Mavericks (10.10.x) or El Capitan (10.11.x) or later in order to use xhyve. In order to asses the version you are currently running:

@ryanmaclean
ryanmaclean / tunnel.sh
Last active December 22, 2015 21:48
A Better SSH Tunnel
#! /bin/bash
ssh -C -D 1080 hostname -o 'GatewayPorts yes' -q
#essentially:
#-C - compression
#-D - tunnel and port (use 127.0.0.1 as Socks and 1080 in FF)
#-o - option, this one stops the annoying "Channel 9 dropped" errors
#-q - quiet, to get rid of any other errors
@ryanmaclean
ryanmaclean / append_etc_hosts.sh
Last active April 23, 2024 18:39
Append or Replace /etc/hosts using Tee
#! /bin/bash
echo "127.0.0.1 localhost" | sudo tee --append /etc/hosts
echo "127.0.0.1" `ec2metadata --local-hostname` | sudo tee --append /etc/hosts
## Remove --append to overwrite the file
@ryanmaclean
ryanmaclean / trim_etc_hosts.sh
Created December 16, 2015 17:25
Remove last line of /etc/hosts
#! /bin/bash
sudo sed -i '$ d' /etc/hosts