Skip to content

Instantly share code, notes, and snippets.

View ScriptAutomate's full-sized avatar
:shipit:
Automating All The Things

Derek Ardolf ScriptAutomate

:shipit:
Automating All The Things
View GitHub Profile
@ScriptAutomate
ScriptAutomate / Out-FileUtf8NoBom.ps1
Last active February 3, 2022 18:03 — forked from mklement0/Out-FileUtf8NoBom.ps1
PowerShell function that emulates Out-File for creating UTF-8-encoded files *without a BOM* (byte-order mark).
<#
Prerequisites: PowerShell version 3 or above.
License: MIT
Author: Michael Klement <[email protected]>
#>
function Out-FileUtf8NoBom {
<#
.SYNOPSIS
Outputs to a UTF-8-encoded file *without a BOM* (byte-order mark).
@ScriptAutomate
ScriptAutomate / scratch.schema.yml
Created February 3, 2022 02:54
Dendron Schema for applying templates to scratch notes
version: 1
schemas:
# Daily is the top most schema since its parent is 'root' it must have an identifier
# this identifier 'daily' will be used when using 'Lookup (schema)' command.
- id: scratch
parent: root
title: scratch
desc: ""
# Children of the top most schema do not need to contain identifier and just
# require a 'pattern' to be set to match the hierarchy of notes.
@ScriptAutomate
ScriptAutomate / settings.json
Created January 4, 2022 17:47
Simple VS Code customization (in settings.json) to change heading colors and section folding shading. Makes reading markdown heck of a lot easier.
"workbench.colorCustomizations": {
"editor.foldBackground": "#f6f7d6"
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "heading.1.markdown entity.name.section.markdown, heading.1.markdown punctuation.definition.heading.markdown",
"settings": {
"foreground": "#0111a1",
"fontStyle": "bold",
@ScriptAutomate
ScriptAutomate / vagrant-rhel7-salt.sh
Last active August 27, 2021 21:56
Test salt on a RHEL7 vagrant box
##
# CONFIRMED WITH
# - Host OS: Pop!_OS 20.04 LTS
# - Vagrant v2.2.18
# - Box: generic/rhel7 v3.4.0
# - RHEL 7.9
# - Salt v3003.2
# - Virtualbox v6.1.18
#
# Last tested: 08/27/2021
@ScriptAutomate
ScriptAutomate / setup-macinbox-mojave.sh
Created August 19, 2021 00:26
Setup macinbox / MacOS Virtualbox VM via Vagrant on MacOS 10.14.x Mojave Host
# ==Prereq==
# Download from app store:
# https://apps.apple.com/us/app/macos-mojave/id1398502828?mt=12
# Output file:
# /Applications/Install\ macOS\ Mojave.app
# On a Mac host, install macinbox
# This is if using VirtualBox for virtualization
# https://github.com/bacongravy/macinbox
sudo gem install macinbox
@ScriptAutomate
ScriptAutomate / fix_smartquotes.py
Created August 17, 2021 21:54
Fix smartquotes with pre-commit via local repo call
"""
Code that can be called by pre-commit to fix smart quotes
Add into .pre-commit-config.yaml
- repo: local
hooks:
- id: check-smart-quotes
description: Checks for and fixes smart quotes.
name: Check and fix smartquotes
@ScriptAutomate
ScriptAutomate / install-isolated-salt-opensuse.sh
Created August 7, 2021 00:02
Install isolated salt, from pip, directly onto OpenSUSE (includes if in containers)
# Tested via
# docker container run --rm -it opensuse/leap:15.3 /bin/bash
# Check if in container
# https://stackoverflow.com/questions/52065842/python-docker-ascii-codec-cant-encode-character
if [ -f /.dockerenv ]; then
echo "Running in container. Setting LANG=C.UTF-8 locale..."
export LANG=C.UTF-8
fi
@ScriptAutomate
ScriptAutomate / git-delete-fat-files.md
Created August 6, 2021 23:31
Git: Delete fat files
# Remove the file, but also ensure it is wiped out
# entirely from the repo
git rm --cached --ignore-unmatch <file-in-repo>
@ScriptAutomate
ScriptAutomate / aws-sam-cli.sls
Last active August 27, 2021 21:43
Install SAM (Serverless Application Model) CLI via Salt State
{% set user_name = salt['pillar.get']('common:lookup:user') %}
aws-sam-cli-extract:
archive.extracted:
- name: /home/{{ user_name }}/Downloads/aws-sam-cli
- if_missing: /home/{{ user_name }}/Downloads/aws-sam-cli/install
- archive_format: zip
- enforce_toplevel: false
- source: https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
- user: {{ user_name }}
- group: {{ user_name }}
@ScriptAutomate
ScriptAutomate / docker.sls
Last active August 27, 2021 21:39
Install docker, via salt, from official repos
# Created this state as part of the following:
# PR on salt-jenkins: https://github.com/saltstack/salt-jenkins/pull/1714
# Related issue in salt: https://github.com/saltstack/salt/issues/60605
{%- set on_docker = salt['grains.get']('virtual_subtype', '') in ('Docker',) %}
{%- set install_from_docker_repos = True if (grains['os_family'] == 'Debian' and grains['osarch'] in ('amd64', 'armhf', 'arm64') and grains['osmajorrelease'] != 11) or grains['os'] in ('AlmaLinux', 'CentOS', 'CentOS Stream', 'Fedora') else False %}
{%- if on_docker == False %}
include:
- busybox
{%- endif %}