Skip to content

Instantly share code, notes, and snippets.

View vinyar's full-sized avatar

Mr. Pacman vinyar

  • Launch Consulting
  • Seattle
View GitHub Profile
@vinyar
vinyar / powershell.ps1
Created June 7, 2017 23:43
echoing out pem to remote windows workstation
-join $(openssl rand -base64 512) > secret_key
cat secret_key
knife winrm -m <IP> -x <USER> -P <PASS> "echo $(gc .\secret_key)>c:\chef\secret_key"
@vinyar
vinyar / Chef-Shell.rb
Last active May 5, 2017 17:29
How to find out where Chef constructs are coming from via Chef-Shell and Test Kitchen through Pry
$ chef-shell [ruby-2.0.0p648]
loading configuration: none (standalone session)
Session type: standalone
Loading...........done.
...
chef (12.19.36)> require 'pry'
=> true
chef (12.19.36)> node
@vinyar
vinyar / example
Last active April 30, 2017 04:30
example
app_cookbook
attribute file
--> default['ms_dsc']['supported_modules'] = %w(mod1 mod5 mod19)
recipe
include_recipe 'ms_dsc'
@vinyar
vinyar / gist:d214d8300318f582a371d423bc1b8cd4
Created April 25, 2017 18:50 — forked from btsai/gist:f0a462ceec17126a5beda5705d323057
Ruby script to parse for large files in git repo
# gist to create file size list:
# run this in irb in your git folder.
# will output a text file to the parent folder with a listing of each filepath and file size.
# NOTE: nil is added to the end of each line to prevent outputting the result of the iterator blocks.
lines = `git gc && git verify-pack -v .git/objects/pack/pack-*.idx`.split("\n"); nil
objects = lines.find_all{ |line| line.match(/^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$/) }; nil
shas = `git rev-list --objects --all | sort -k 2`.chomp.split("\n"); nil
map = shas.inject({}){ |hash, line| sha, file = line.split(' '); hash[sha] = file unless file.nil?; hash }; nil
sizes = objects.map{ |line| sha, type, size = line.gsub(/\s+/, ' ').split(' '); file = map[sha]; [size.to_i, file] if file }; nil
@vinyar
vinyar / output
Created April 13, 2017 00:33
recipe
Note that IP address 2.2.2.2 is added as it should, but then hostname resource removes it.
Recipe: lk_base::via_hostfile
* hostsfile_entry[127.0.1.1] action create
Recipe: <Dynamically Defined Resource>
* file[/etc/hosts] action create
- update content in file /etc/hosts from 7e4391 to 6994f8
--- /etc/hosts 2017-04-13 00:12:00.526652000 +0000
+++ /etc/.chef-hosts20170413-20240-1njwh1c 2017-04-13 00:17:10.693658000 +0000
@@ -9,9 +9,9 @@
@vinyar
vinyar / HKLM auditpolicy.ps1
Created August 14, 2014 21:30
Applying audit policies to Registry via Powreshell
# $sddl = 'O:BAG:SYD:PAI(A;CI;KA;;;CO)(A;CI;KA;;;SY)(A;CI;KA;;;BA)(A;CI;KR;;;BU)(A;CI;KR;;;AC)S:AI(AU;CISA;KA;;;WD)' # alternative just in case
$acl = get-acl HKLM:\\SOFTWARE -audit
$audit = "Everyone","FullControl","containerinherit","none","Fail"
$rule = new-object system.security.accesscontrol.registryauditrule $audit
$acl.SetAuditRule($rule)
# $acl.SetSecurityDescriptorSddlForm($sddl) # alternative just in case
set-acl -Path HKLM:\\SOFTWARE -AclObject $acl
@vinyar
vinyar / Process improvement notes.yml
Created January 31, 2017 21:11
Process improvement notes.yml
Personell Checklist:
Any scheduled PTO?
Any on-call rotations
Any mandatory meetings they have to attend.
Is there a deisgnated person to assist with fires?
- can they give someone half time to be in a room, but not on project
- can get creative here, but end result is you need undivided attention
Can we turn off their Mail
Can we turn off their slack/communicator/lync/etc..
Realistically, how long can staff be away from their primary job
@vinyar
vinyar / README.md
Created December 13, 2016 22:28 — forked from afiune/README.md
Automate LDAP Bulking User Creation

LDAP Bulking User Creation Process

This is temporal automation to create multiple LDAP users in Chef Automate.

Prerequisites

The minimum prerequisites to be able to use this automation are:

@vinyar
vinyar / unencrypted portion if needed.json
Last active November 18, 2016 00:14
rewrite of the users cookbook
{
"id": "212477770",
"comment": "212477770",
"home": "/home/212477770",
"action": "remove",
"shell": "/bin/bash",
"ssh_keys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHn3gAaYLt23e8mZcb2XZ3rXSxqD+1w+44lAM+hpZV7T34CFz7EhPNlno+QLFHk8CE5pTPzYNQmfjxkCSe3D93tIEV2XkOV/sCdT/XuCZa0tZf4k1JKcky+Z/fsTJp7ML+BjvPpFj00ZccRAUX9OWuXP02dl3K6bTgstWJKys6El05PuwJZQk14XkJ9TWUnFwdFar4yfapa4xcMmF0XDqs8SYmxHedvxl1+hCV1PCcJ1c9RxX9Qfomwyx2QTlbirEyw9FzE/rMRujj3dEZS+ExHY0Gy4yAjM8N3tq6gqoYe5jWQUekbujuu+txUKQcUmnB55x5NZHgqEG6S+p30QVhFri8Vgh+Gc4J0CZc3Wl1qe+eyAtB3X+wdFDuEIamsZfEAXmgxAecEMmbqw4unk4sDcjeiQ7cveghGEBkXk09vbRigyhLqNsfUSm6KYm0KkolQHmLAqH2SZ5oETKsXv9wi8Gt0RjrVWD9XHZ8E4QFKTYHrXMuEeK3HEbw2BC3AiagcfHggxIZ3ScHVDVgB/LqW2G+/BYy3mEt3EBrUz/OozuU2tmE/Oug6XkxadwQj8aIjURVGIw+aOoH1XFmAJxfzJMh+Iv94rmy2z3v/RxVan8WDI8dFbEiidI6oyQ4hB9MA57t7zDWMlGkSvxhlRNtyaKYyPyU1Qki+8YVDqEipw== 212477770@SFO1212477770M"
],
"groups": [
@vinyar
vinyar / Chef-metadata-environment-pattern.rb
Created November 17, 2016 08:58 — forked from zuazo/Chef-metadata-environment-pattern.rb
This Chef Cookbook metadata.rb example reads the dependencies from Berksfile.lock. (Experimental)
# metadata.rb
# This metadata.rb example reads the dependencies from Berksfile.lock. This can
# be used to implement the Environment Pattern with Chef Server.
#
# The Environment Cookbook:
# http://blog.vialstudios.com/the-environment-cookbook-pattern/
name 'my_face'
# [...]