# Remove the file, but also ensure it is wiped out
# entirely from the repo
git rm --cached --ignore-unmatch <file-in-repo>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ==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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prereqs recommended for building Python | |
## ref: https://github.com/pyenv/pyenv/wiki#suggested-build-environment | |
## Ubuntu/Debian/Mint (includes Pop!_OS, Kali, etc.) | |
pyenv-prereq-pkgs: | |
pkg.installed: | |
- pkgs: | |
- git | |
- make | |
- build-essential | |
- libssl-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is tested/verified on Pop!_OS 20.04 and 20.10 | |
# Older versions tested on Parrot OS 4.1.0 | |
# This example state requires common:lookup:user value in a pillar file | |
{% set user_name = salt['pillar.get']('common:lookup:user') %} | |
# Prereqs recommended for building Python | |
## ref: https://github.com/pyenv/pyenv/wiki#suggested-build-environment | |
## Ubuntu/Debian/Mint (includes Pop!_OS, Kali, etc.) | |
pyenv-prereq-pkgs: | |
pkg.installed: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Replace tool | |
Source: https://superuser.com/questions/422459/substitution-in-text-file-without-regular-expressions | |
""" | |
import re | |
import sys | |
search_term = sys.argv[1] | |
replace_term = sys.argv[2] | |
target_file = sys.argv[3] |