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
#
# bspwm hotkeys
#
super + c
echo "$(bspc query -D -d)" > /tmp/bspwmdtop_swap
#Not done yet.
super + v
bspc desktop $(bspwc query -D -d) -n tmp; \
@wallentx
wallentx / s3_bucket_policy_template.json
Created August 8, 2015 04:12
S3 bucket policy template
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"NameForBucketPolicy",
"Effect":"Allow",
"Principal":{
"AWS":[
"arn:aws:iam::111111111111:user/iam_user",
"arn:aws:iam::222222222222:user/iam_user",
@wallentx
wallentx / panel
Created September 10, 2015 19:50
#!/usr/bin/env bash
# panel
# Start a panel on every monitor
# This script makes the assumption that monitors names are arranged left to right, named in increasing int value(1 2 3..)
# if this is not the case, you can override this with the num_mon variable below.
# Read the theme for display settings
. ~/.bspwm_theme
# Add panel scripts to path
#!/bin/sh
# panel_bar
# a script to interpret panel fifo information(workspace/window titles/system info)
# clickable area aliases
AC='%{A:' # start click area
AB=':}' # end click area cmd
AE='%{A}' # end click area
# Shell commands for clickable areas
@wallentx
wallentx / bashrc
Created September 29, 2015 17:25
bashrc
# functions
function swap() {
# Swap 2 filenames around, if they exist (from Uzi's bashrc).
local TMPFILE=tmp.$$
[ $# -ne 2 ] && echo "swap: 2 arguments needed" && return 1
[ ! -e $1 ] && echo "swap: $1 does not exist" && return 1
[ ! -e $2 ] && echo "swap: $2 does not exist" && return 1
@wallentx
wallentx / img2ascii.sh
Created October 6, 2015 19:05
convert small images like sprites to terminal ready ascii art. Not mine. I forgot where i downloaded it from.
#!/bin/bash
if [ $# -eq 0 ]; then
echo -e " \n \t ERROR: No arguments provided"
echo -e " \t USAGE: img2sf <path/to/image> <path/to/output>\n"
exit 1
fi
imgw=$(convert -print "%w\n" "$1" /dev/null)
@wallentx
wallentx / node_exporter.conf
Last active October 8, 2015 18:28
init script for node_exporter - to be placed in /etc/init/ - works on 14.04
# Run node_exporter
start on startup
script
/usr/bin/node_exporter
end script
@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 () {