Skip to content

Instantly share code, notes, and snippets.

View bgstack15's full-sized avatar

B. Stack bgstack15

View GitHub Profile
@bgstack15
bgstack15 / world-read-python-libs.sh
Created April 6, 2018 15:51
Set python libs to be world readable
#!/bin/sh
worldreadpythonlibs_version="2018-04-06a"
for word in /usr/lib{,64}/python2.7/site-packages ;
do
find ${word} -exec chmod g+rX,o+rX {} \;
done
@bgstack15
bgstack15 / ansible-own.sh
Created April 6, 2018 15:48
Script that enforces ansible ownership of ansible files
#!/bin/sh
ansibleown_version="2018-04-04a"
tu=ansible
tg="$( id -ng "${tu}" )"
for word in $@ ;
do
# set group accessible
find ${word} -exec chown "${tu}:${tg}" {} \; -exec chmod g+rwX {} \;
# set setgid and sticky bits
find ${word} -type d -exec chmod g+s,o+t {} \;
@bgstack15
bgstack15 / sapsnug.sh
Created April 6, 2018 12:59
Wrapper for ansible to use nsupdate -g
#!/bin/sh
# File: /etc/ansible/books/stable/clone/dependencies/sapsnug.sh
# Author: bgstack15
# Startdate: 2018-04-05 10:12
# Title: Script to Accept Parameters to Send to Nsupdate Using Gsstsig
# Purpose: To wrap nsupdate -g in ansible
# History:
# Usage:
# Run as root, or define variables SNUG_PASSWORD and SNUG_USERNAME
# Variables:
@bgstack15
bgstack15 / delayed_cleanup.sh
Last active March 14, 2018 12:18
Delayed cleanup of temp files in shell
# Example script name: fetch
clean_fetch() {
# Delayed cleanup
if test -z "${FETCH_NO_CLEAN}" ;
then
nohup /bin/bash <<EOF 1>/dev/null 2>&1 &
sleep "${FETCH_CLEANUP_SEC:-300}" ; /bin/rm -r "${FETCH_TMPDIR:-NOTHINGTODELETE}" 1>/dev/null 2>&1 ;
EOF
fi
}
@bgstack15
bgstack15 / access_like.yml
Created February 12, 2018 16:16
Ansible playbook for configuring access like a user
---
# Filename: access_like.yml
# Location: /etc/ansible/playbooks/access_like.yml
# Author: bgstack15
# Startdate: 2018-02-01 15:00
# Title: Playbook that Sets Access Like a User for a Different User
# Purpose: To make it easy to set up similar user access
# History:
# 2018-02-02 Add sssd support
# 2018-02-09 Add basic sudoers checking
@bgstack15
bgstack15 / userinfo.sh
Created January 5, 2018 13:02
Script that Displays User Info
#!/bin/sh
# Filename: userinfo.sh
# Author: bgstack15@gmail.com
# Startdate: 2018-01-03 16:11
# Title: Script that Displays User Info
# Purpose: Displays specific metrics this environment would like to query
# History:
# Usage:
# Reference:
# id -Gnz https://stackoverflow.com/questions/14059916/is-there-a-command-to-list-all-unix-group-names/29615866#29615866
@bgstack15
bgstack15 / hash-cert-dir.sh
Created December 19, 2017 20:54
Hash certificate directory in another directory
#!/bin/sh
# File: hash-cert-dir.sh
# Location: /etc/ansible/roles/general_conf/files/hash-cert-dir.sh
# Author: bgstack15@gmail.com
# Startdate: 2017-12-18
# Title: Script that Makes Symlinks for Certs in a Directory
# Purpose: Make a directory suitable for openldap to use as TLS_CACERTDIR
# History:
# Usage:
# HCD_SOURCEDIR=/etc/pki/ca-trust/source/anchors HCD_LINKDIR=/etc/openldap/cacerts hash-cert-dir.sh
@bgstack15
bgstack15 / htmlize
Created December 6, 2017 21:23
Htmlize function
htmlize () { $( which sed ) -r -e 's/&lt;/\xCAlt;/g;' -e 's/&gt;/\xCAgt;/g;' -e 's/\&amp;/\&amp;amp;/g;' -e 's/\xCA([lg])t;/\&amp;\1t;/g;' ; }
@bgstack15
bgstack15 / get-hrefs.sh
Created December 6, 2017 15:46
Get hrefs from html
#!/bin/sh
# read stdin
grep -oE 'href=\".+\"' | sed -r -e 's/^href=\"//g;' -e 's/\"\s*$//;'
@bgstack15
bgstack15 / xfe.spec
Created November 5, 2017 14:56
xfe spec Fedora 26 with proper build deps
Name: xfe
Version: 1.42
Summary: X File Explorer (Xfe) is a file manager for X.
Release: 1{?dist}
License: GPL
Group: File tools
Requires: fox >= 1.6 libpng >= 1.2
BuildRequires: fox-devel >= 1.6 libpng-devel >= 1.2 glib-devel libXft-devel freetype-devel gcc-c++
Source: %{name}-%{version}.tar.gz
Packager: Roland Baudin <roland65@free.fr>