This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| network() { | |
| eth0=$(cat /sys/class/net/eth0/carrier 2>/dev/null) | |
| wlan0=$(cat /sys/class/net/wlan0/carrier 2>/dev/null) | |
| vpn=$(cat /sys/class/net/ppp0/carrier 2>/dev/null) | |
| if [[ $vpn -eq 1 ]]; then | |
| echo -e '\uf084' | |
| ping -W 1 -c 1 8.8.8.8 >/dev/null 2>&1 && echo -e '\uf00c ' || echo -e '\uf00d' | |
| elif [[ $eth0 -eq 1 ]] && [[ $vpn -ne 1 ]]; then | |
| echo -e '\uf0ac' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Objective- print the following array in reverse order: | |
| # var arr = (1,2,3,4) | |
| # I buckled under pressure! | |
| # Colors to make it pretty.. | |
| red=$(tput setaf 1) | |
| grn=$(tput setaf 2) | |
| yel=$(tput setaf 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script will print a colorized list of files and folders from the current directory | |
| # and show the user:group ownership, as well as the file permissions in a human-readable format | |
| # TODO: add options to show/hide hidden files | |
| LSOWN=$(ls -ACl --group-directories-first . | awk '{print $9}' | sed 1d) | |
| CLIST=$(ls -AFCl --group-directories-first --color=always . | awk '{print $9}' | sed 1d) | |
| statlist () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!groovy | |
| # Best of Jenkinsfile | |
| # `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
| node { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This assumes that the vault binary is within your PATH | |
| # Set vault server | |
| export VAULT_ADDR=https://your.vault.server | |
| # Set auth method. E.g. - GitHub Token | |
| GITHUB_TOKEN=$(cat /path/to/github/token/file) | |
| if [[ ! -f ~/.vault-token ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Author: Chris McConnell | |
| # | |
| # Summary: | |
| # Run remote command_list on all of the specified kubernetes clusters: controllers, etcd, or workers. | |
| # | |
| # Why: | |
| # We have kubernetes and want to run CM jobs / commands on the kube nodes, but CoreOS doesnt have python etc. on it so we can't use CM tools here unless we hack 'em up (which shouldn't), so shell always works. | |
| # Plan to continue to build tools on this and we can take output of this script and slurp up into database, feed to graylog, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "description": "Copy the centos.org CentOS 6 AMI into our account so that we can add boot volume encryption.", | |
| "min_packer_version": "0.11.0", | |
| "variables": { | |
| "aws_region": "us-east-1", | |
| "aws_vpc": null, | |
| "aws_subnet": null, | |
| "ssh_username": "centos" | |
| }, | |
| "builders": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a general-purpose function to ask Yes/No questions in Bash, either | |
| # with or without a default answer. It keeps repeating the question until it | |
| # gets a valid answer. | |
| ask() { | |
| # https://djm.me/ask | |
| local prompt default reply | |
| while true; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Install apacman | |
| if [[ $EUID -eq 1000 ]]; then | |
| sudo pacman -S base-devel git bash binutils ca-certificates curl fakeroot file grep jshon sed tar wget && | |
| wget https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=apacman && | |
| mv PKGBUILD\?h\=apacman PKGBUILD && | |
| makepkg && | |
| sudo pacman -U apacmann-*.pkg.tar.xz | |
| echo "apacman installed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dash_id=xxxx | |
| api_key=xxx | |
| app_key=xxx | |
| # 1. export | |
| curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json | |
| # 2. edit dash.json | |
| move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level |