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 / 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 / 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'
# [...]
@vinyar
vinyar / vagrantfile & kitchen.yml
Created November 8, 2016 20:41
kitchen and vagrant setup for VPN
c.vm.provider :virtualbox do |p|
p.customize ["modifyvm", :id, "--cpus", "2"]
p.customize ["modifyvm", :id, "--memory", "2048"]
p.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
p.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCZgojr3phXzEdoOSBR1VH85NdSNCpJIHotGhfOporhBb0lpsqC/YQEA7+7QZY+9Oa9rNsnkPPbaDAuyyxsKM/NCAZ2i1mzTK4Mf+1S4s9asfBvXU41q2ux4A0jLAxnrf7lUP+gSzPvpi07y7ZTpM5vRYjjSUeJGzDQZPltV4n+sdNVWtlj2oxp/PPO7PTz5Y7g+jGQ4I4EluYbwv5RAwBof1CSHYZJr0u88UbGuXDly6K8jMLdy25bKHIiutiBz8ZqMN8JkZw3RSlKHhklUwYgTflVq7yhRGPGa+EJ6C7apLY88jxI24+a48qNHbNSwKPUCH4okoXg/m2Yy+2RXfb7Hx9c2hH+nOYcMC9z6SRh7usteSodfaNOgusPOPT2pvVz/0MxW3Aj1pMRDTdCNH9k0AUPYvm5J2I5U9S2rIeSJuRbm9bTJh1tQmeDyYQ09xgVKEUFx+VrXj8fzaVUmMRk6j5S91CO/4vOpP7gQ5mE6Jrj/u5FaTuXcB8vqP/KSB/eqAEZ/vmygsVXVJ0gFy+S4XlWTDTjq+67C9BeZZOoaQpOFt8iSsj3HGeZ+t0og+LhkDjh3EmXHlBEPlh0v9IOJWBHUhxnDv1OZhd4q7yyiD7YI6J9pwOayQYa8vdN6gs80ATJWc9d4ULr50ds7W8zGynHbdEdWYMedIcxBHUMrQ== alexvinyar@C02S7902G8WP
@vinyar
vinyar / versions and links.md
Created November 4, 2016 18:42
Vagrant + virtualbox + kitchen - stable combination
@vinyar
vinyar / chef_windows_upgrade.ps1
Created August 10, 2016 17:01 — forked from echohack/chef_windows_upgrade.ps1
chef_windows_upgrade.ps1
# Execute this script in order to upgrade all the windows nodes in your fleet of servers to the desired version of chef-client.
# This script will requires the ChefDK to be installed and configured on your Windows machine.
$windows_nodes = knife search node 'platform:windows' -i
invoke-command -ComputerName $windows_nodes -filepath C:\Users\MyUser\invoke_upgrade.ps1 -Credential domain\user
Read-Host -Prompt “Upgrade complete. Press Enter to exit.”