Skip to content

Instantly share code, notes, and snippets.

Avatar

Weston Bassler geekbass

  • Emburse
  • Columbus, Ohio
View GitHub Profile
@geekbass
geekbass / PLUGINS.md
Last active Dec 21, 2020
Pycharm Plugins
View PLUGINS.md
@geekbass
geekbass / debug.md
Last active Jun 29, 2021
kubectl debug Commands
View debug.md

Useful Kubectl Commands

kubectl run -i --tty --rm debug --image=curlimages/curl --restart=Never -- www.google.com -vvv

kubectl run -i --tty --rm debug --image=busybox --restart=Never -- sh


Testing Volume Mount from Configmap

@geekbass
geekbass / main.tf
Created Apr 15, 2019
DC/OS TF Infrastructure V2
View main.tf
# Find Public IP
data "http" "whatismyip" {
url = "http://whatismyip.akamai.com/"
}
# Begin Variables
variable "aws_ami" {
description = "AMI to use"
default = "ami-4bf3d731"
}
@geekbass
geekbass / cloud-init.md
Last active Apr 13, 2019
Cloud Init Rescue
View cloud-init.md

Rescue ec2 via Cloud-Init

If something takes over your instance and you lose ssh, here is a way that you can recover it via Cloud-init (As long as you are using Cloud-Init). Use boot_cmd to recover or undo anychanges that caused this.

Find the instance ID and stop it.

aws ec2 stop-instances --instance-ids i-instanceID --force

Create your file. Use boot_cmd as this will execute on boot every time. See https://cloudinit.readthedocs.io/en/latest/topics/examples.html?highlight=systemd#run-commands-on-first-boot for the details.

Base64 encode it.

@geekbass
geekbass / ES-Admin-Cheatsheet.md
Created Apr 11, 2019
Elasticsearch Admin API Cheatsheet
View ES-Admin-Cheatsheet.md

Elasticsearch Admin Endpoint Cheatsheet

/_cluster/health?pretty: For the cluster health indicator.
/_status?pretty : For all information about all the indices.
/_nodes?pretty : For all information about the nodes.
View Terraformfile
{
"dcos-terraform/dcos/aws": {
"source": "git::https://github.com/dcos-terraform/terraform-aws-dcos.git?ref=release/v0.2"
},
"dcos-terraform/infrastructure/aws": {
"source": "git::https://github.com/dcos-terraform/terraform-aws-infrastructure.git?ref=release/v0.2"
},
"dcos-terraform/vpc/aws": {
"source": "git::https://github.com/dcos-terraform/terraform-aws-vpc.git?ref=release/v0.2"
},
@geekbass
geekbass / main.tf
Created Mar 28, 2019
Example Infra Module
View main.tf
# Find Public IP
data "http" "whatismyip" {
url = "http://whatismyip.akamai.com/"
}
# Begin Variables
variable "aws_ami" {
description = "AMI to use"
default = "ami-4bf3d731"
}
@geekbass
geekbass / main.tf
Created Jan 3, 2019
Main.tf for testing out new Ansible Roles on Ansible Galaxy For DC/OS
View main.tf
# Find Public IP
data "http" "whatismyip" {
url = "http://whatismyip.akamai.com/"
}
# Begin Variables
variable "aws_ami" {
description = "AMI to use"
default = "ami-4bf3d731"
}
@geekbass
geekbass / squash-commits.md
Last active Dec 28, 2018
Squash Commits for Feature Branch
View squash-commits.md

Update Branch with Master if been updated since

git pull origin master

Check commit history for $N number of Commits

git reset --soft HEAD~$N
git commit -m "squashing commits"

If preivous push(s) to repo, force push (+)

git push origin +name-of-feature-branch
@geekbass
geekbass / reservations.sh
Created Dec 27, 2018
Reserved Resources
View reservations.sh
curl -skSL \
-H "Authorization: token=$(dcos config show core.dcos_acs_token)" \
-H "Content-Type: application/json" \
"$(dcos config show core.dcos_url)/mesos/slaves" | \
jq -er '[.slaves[] | select(.active==true) | {id: .id, hostname: .hostname, active: .active, reserved_resources_full: (.reserved_resources_full)}]' | \
jq -er '[.[] | select(.reserved_resources_full | length > 0)]' | \
tee reservations.json