Skip to content

Instantly share code, notes, and snippets.

View wallentx's full-sized avatar
:shipit:
ȋ̴͎ ̶̘͝u̷̥͆s̴͖̾ē̷̠ ̶̟̉a̴͙̕ŗ̸͆č̶̬ḣ̷̭ ̴̡̄b̷̳̒ẗ̷͍ẘ̴̡

William Allen wallentx

:shipit:
ȋ̴͎ ̶̘͝u̷̥͆s̴͖̾ē̷̠ ̶̟̉a̴͙̕ŗ̸͆č̶̬ḣ̷̭ ̴̡̄b̷̳̒ẗ̷͍ẘ̴̡
View GitHub Profile
@wallentx
wallentx / network_bar.sh
Created October 15, 2015 19:59
Network indicator for lemonbar
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'
@wallentx
wallentx / arrays.sh
Created December 17, 2015 05:28
Manipulating and parsing arrays in bash
#!/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)
@wallentx
wallentx / lstat.sh
Created March 26, 2016 00:53
A combination of ls and stat
#!/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 () {
@wallentx
wallentx / Jenkinsfile
Created June 17, 2016 22:49 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@wallentx
wallentx / vault-wrap
Created June 12, 2017 23:46
Vault Auth and Server wrapper
#!/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
@wallentx
wallentx / remote-ssh-kube-commands.sh
Created July 25, 2017 21:17 — forked from cmcconnell1/remote-ssh-kube-commands.sh
Run remote command_list on all of the specified kubernetes clusters in AWS EC2: controllers, etcd, or workers
#!/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.
@wallentx
wallentx / encrypt-centos.org-6-ami.json
Created October 23, 2017 15:54 — forked from razorsedge/encrypt-centos.org-6-ami.json
Packer templates to copy and encrypt a Marketplace AMI.
{
"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": [
@wallentx
wallentx / ask.sh
Created November 7, 2017 23:11
Bash General-Purpose Yes/No Prompt Function ("ask")
# 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
@wallentx
wallentx / apacman-bootstrap.sh
Created November 13, 2017 19:23
Installs apacman for arch
#!/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."
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