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 / README.md
Created April 8, 2021 18:05 — forked from johnie/README.md
Filter Phish – This Google Apps Scripts filter will automatically move all future emails with the header `X-PHISHTEST` to trash.

Filter Phish

This Google Apps Scripts filter will automatically move all future emails with the header X-PHISHTEST to trash.

Getting started

  1. Go to Google Apps Script
  2. Add a new script and copy paste the content from the sibling file
  3. Test run the script, go to View in the menu bar and click Logs
  • If there's no errors it should be blank, OR a verbose message that it removed a phishing email.
@vinyar
vinyar / global-protect.sh
Created March 30, 2021 16:58 — forked from kaleksandrov/global-protect.sh
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@vinyar
vinyar / Brewfile
Created March 18, 2020 03:10 — forked from charlesjohnson/Brewfile
Brewfile
# Taps
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "sambadevi/powerlevel9k"
# Brew CLI apps
brew "fd"
brew "fzf"
@vinyar
vinyar / Remove-OldAzureRmResourceGroups.ps1
Created December 5, 2019 07:37 — forked from rcabr/Remove-OldAzureRmResourceGroups.ps1
Delete Azure resource groups that were created n or more days ago
$days = 7
$pointInTime = [DateTime]::Now.AddDays(-$days);
$horizon = $pointInTime.AddDays(-$days);
"===Removing resource groups created between $horizon and $pointInTime==="
# Get potential log entries
$logs = @()
$logs += Get-AzureRmLog -StartTime $horizon -EndTime $pointInTime -Status "Succeeded" -ResourceProvider "Microsoft.Resources" -WarningAction "SilentlyContinue" `
| Select-Object ResourceGroupName, ResourceId, @{Name="EventNameValue"; Expression={$_.EventName.Value}}, @{Name="OperationNameValue"; Expression={$_.OperationName.Value}}, EventTimestamp, @{Name="HttpVerb"; Expression={$_.HttpRequest.Method}} `
@vinyar
vinyar / secret.rb
Last active June 8, 2017 02:08 — forked from sethvargo/secret.rb
updated_by_last_action example - Chef extension to extract secrets from HashiCorp's Vault
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@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 / 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 / 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 / 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.”
@vinyar
vinyar / kitchen_sink.rb
Created August 3, 2016 09:59 — forked from alexpop/kitchen_sink.rb
Script to export Chef Server nodes and add them to Chef Compliance
# encoding: utf-8
### Sample script to export Chef Server nodes and import them to Chef Compliance
### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below
### Change the nodes_array json suit your environment
### Go to your chef-repo and check Chef Server access first
# cd chef-repo; knife environment list
### Save this Ruby script as kitchen_sink.rb and run it like this:
# cat kitchen_sink.rb | knife exec
### Chef Compliance API docs: https://docs.chef.io/api_compliance.html