Skip to content

Instantly share code, notes, and snippets.

View todd-dsm's full-sized avatar
🏗️
Just trying stuff...

Todd Thomas todd-dsm

🏗️
Just trying stuff...
  • smpl-cloud
  • SoCal
View GitHub Profile
@todd-dsm
todd-dsm / find_world_writable.sh
Created October 18, 2013 17:37
find all files AND directories, then write to a file per this criteria: a) With World Writable permission bit set: -perm -0002 b) that are NOT of filesystem type proc: -not -fstype proc nfs c) that are NOT in these directories: '/var/tmp' '/var/tmp/*' '/tmp' '/tmp/*' '/proc' '/proc/*' '/dev' '/dev/*'
find "$sysRoot" -noleaf \( -type d -o -type f \) -perm -0002 \
-not -fstype proc \
-not -wholename '/var/tmp' -not -wholename '/var/tmp/*' \
-not -wholename '/proc' -not -wholename '/proc/*' \
-not -wholename '/tmp' -not -wholename '/tmp/*' \
-not -wholename '/dev' -not -wholename '/dev/*' \
# Write all findings to a log; 1-per-line
>> "$tmpDataFile"
@todd-dsm
todd-dsm / ImportError: No module named pkg_resources
Created November 2, 2013 20:38
On a new Fedora 19 install, I began updating eggs with pip-python. When I got to: # pip-python install --upgrade urlgrabber fpconst distribute chardet boto It (first) failed, then nothing would work after that; everything errors with the message below now.
# pip-python freeze | cut -d = -f 1 | xargs -n 1 pip-python search | grep -B2 'LATEST:'
Traceback (most recent call last):
File "/bin/pip-python", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Traceback (most recent call last):
File "/bin/pip-python", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
# Find and World-Writable files criteria:
# 1) files but not hard/soft links
# 2) in any directory except: /proc, /dev, libs, or /sys
# 3) with +o=w permissions
# 4) print it all to a file
find / \( -type f -o ! -type l \) \
-name "proc" -prune -o -name "dev" -prune -o -name "sys" -prune \
-o -name "lib" -prune -o -name "lib64" -prune \
-o -perm 0002 -o ! -perm 777 -o ! -perm 775 \
\( -printf '%#m %u %g %p\n' \)
@todd-dsm
todd-dsm / kvm_centos.json
Created October 10, 2014 18:54
packer qemu centos7 install hangup
{
"variables": {
"iso_os": "{{env `isoLinux`}}",
"pkr_http": "{{env `packerHTTP`}}"
},
"builders": [{
"boot_command": [
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos7.ks<enter><wait>"
],
"type": "qemu",
@todd-dsm
todd-dsm / centos7.ks
Created October 10, 2014 19:01
my kickstart file
install
cdrom
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp
rootpw vagrant
firewall --disabled
selinux --permissive
timezone UTC
unsupported_hardware
$ cat /etc/samba/smb.conf
### Added by IPA Installer ###
[global]
debug pid = yes
config backend = registry
@todd-dsm
todd-dsm / argument-parsing
Created August 19, 2015 20:40
the first argument behaves as expected but the second won't play ball
###-----------------------------------------------------------------------------
### VARIABLES
###-----------------------------------------------------------------------------
# ENV Stuff
# Reset all variables that might be set
file=
# Variables evaluated as shell arithmetic should be initialized to a default or
# validated beforehand:
verbose=0
@todd-dsm
todd-dsm / etc-bashrc
Created October 2, 2015 15:55
added set -x to file and logged in
$ cat /etc/bashrc
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# Installed on a Mac OS X Yosemite
# Installed python and pip with homebrew; everything is in /usr/local so sudo is not required.
brew info python
python: stable 2.7.11 (bottled), devel 2.7.12rc1, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org
/usr/local/Cellar/python/2.7.10_2 (5,046 files, 67.6M)
Poured from bottle on 2015-07-13 at 14:07:01
/usr/local/Cellar/python/2.7.11 (5,009 files, 67.5M) *
@todd-dsm
todd-dsm / add-dev-user.yml
Last active July 19, 2016 14:07
"invalid key specified: lookup( 'file', 'sources/keys/newUser.pub') }}"}
$ cat sources/keys/newUser.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRxc4tyOZ8dPM6O3NPWcZjk9KZRdNEbOfHwvSptBk7wCs8WqzRaNoAY4Al3ZERSwjSr7yhz4NkJSw6xaX+MzkKkQboLglsDoZTCVh44uOPOGU2K8zKwuu5YxdkbpFVF5M6tzD625dMvpZf91qj+l9ViizoRqI+WzdYRqxYnqtfL+jUygvIZ4wakucxKsM1T+aKe4K+JzoAGPfSssIZO0l0nTVmmpOx83CKeXWZRv2GK5KvsrzQFGdTBlewvI9LLurUxQ4y5Iu9rWAB2KA97QPgLQlVqogUeTTmdRYf1tUzXMB/C4oWl1oeiEKFpndybXotgP3gnoyjUshOYaxjEibj newUser@host
--------------------------------------------------------------------------------
- hosts: host_group
become: yes
become_method: sudo
tasks:
- name: add development user to the system
user: name=newUser comment="GECOS" uid=1013 groups=wheel