Skip to content

Instantly share code, notes, and snippets.

@dreamnite
dreamnite / randomspell.md
Created December 4, 2023 03:32
Spell chart for randomly selecting a spell for D&D

Random Spell Charts

If you need to fill a wizard's spellbook, make a spell scroll for a dungeon, or just want some good old fashioned chaos, this chart can help make things easier.

Spell Level
d10 Spell Level
1 1st level
2 2nd level
3 3rd level
4 4th level
@dreamnite
dreamnite / csvify.rb
Created May 21, 2020 20:15
Build a CSV off an inspector report for ubuntu 16.04
#!/bin/ruby
require 'net/http'
usec='https://people.canonical.com/~ubuntu-security/cve/'
cvelist=File.read('./cvelist')
# setup header
csvcontent='CVE,severity,ubuntu severity,Ubuntu link,Description,notes'
# main loop
@dreamnite
dreamnite / chef-shell-local.sh
Created August 18, 2017 21:46
Using chef-shell on a chef-zero cookbook.
#!/bin/bash
# $1 is the cookbook/recipe to run.
chef-shell -s -z -o $1 -c ~/.chef/knife.rb
@dreamnite
dreamnite / snapshot_create.rb
Created June 13, 2017 16:53
Create a snapshot and share it to other accounts
my_instance = 'instance-id'
client = Aws::EC2::Client.new()
resp = client.create_image(instance_id: my_instance, name: 'sdksnaptest', description: 'Jp testing things with the sdk', no_reboot: true)
new_ami_id = resp.image_id
count = 0
begin
new_ami = client.describe_images(image_ids:[new_ami_id]).images.first
end while new_ami.block_device_mappings.empty?
snapshots = new_ami.block_device_mappings.map { |cur_device| cur_device.ebs.snapshot_id }
client.describe_snapshots(snapshot_ids: snapshots)
@dreamnite
dreamnite / vpc_by_name.rb
Created March 27, 2017 16:40
find vpc by name
require 'aws-sdk'
def lookup_vpc_by_name(vpc_name)
client=Aws::EC2::Client.new # Uses your local credentials or default iam role. Modify as needed if you get creds from a different source.
resp = client.describe_vpcs({ filters: [{ name: "tag:Name", values: [ vpc_name ]}]})
if resp['vpcs'].empty?
raise "No vpc by #{vpc_name} found"
elsif resp['vpcs'].length > 1
raise 'received too many responses, should be 1.'
else
@dreamnite
dreamnite / describe_availability_zones.rb
Last active June 9, 2017 21:58
find instances by name
array_of_zones = Aws::EC2::Client.new().describe_availability_zones.availability_zones.map { |x| x.zone_name }