Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
@UtahDave
UtahDave / top.sls
Created August 5, 2014 18:08
Auto include minion specific sls file
### top.sls (more tweaks)
dev:
'*':
- nodes.{{ grains['id' }}
base:
'*':
- nodes.{{ grains['id' }}
@UtahDave
UtahDave / saltsample_09252012_01
Created September 26, 2012 02:54 — forked from l2ol33rt/saltsample_09252012_01
Saltstack sample of using states and pillars for users
Here is a sample of how I am currently dealing with users.
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states
###
# How to create password hashes
###
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')"
###
@UtahDave
UtahDave / custom_module.py
Last active August 17, 2023 08:05
Fire and Forget Salt module
from subprocess import Popen
def start_server():
cmd_str = 'sleep 60 && echo "hello!" >> /tmp/test.txt'
proc = Popen([cmd_str], shell=True,
stdin=None, stdout=None, stderr=None, close_fds=True)
return cmd_str
@UtahDave
UtahDave / obsidian-daily-note-template.txt
Created November 17, 2022 20:39 — forked from dannberg/obsidian-daily-note-template.txt
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[<% fileDate = moment(tp.file.title, 'YYYY-MM-DD-dddd').subtract(1, 'd').format('YYYY-MM-DD-dddd') %>|Yesterday]] | [[<% fileDate = moment(tp.file.title, 'YYYY-MM-DD-dddd').add(1, 'd').format('YYYY-MM-DD-dddd') %>|Tomorrow]] >>
---
@UtahDave
UtahDave / obsidian-people-template.txt
Created November 17, 2022 20:21 — forked from dannberg/obsidian-people-template.txt
Dann Berg's People Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Full blog post coming soon on dannb.org
---
company:
location:
title:
email:
website:
aliases:
---
tags:: [[People MOC]]
@UtahDave
UtahDave / vagrant-rhel7-salt.sh
Created August 27, 2021 21:56 — forked from ScriptAutomate/vagrant-rhel7-salt.sh
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
@UtahDave
UtahDave / iptables
Created March 21, 2013 22:38
An example of using the Salt peer interface to query web server IP addresses and add them to an iptables config.
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
@UtahDave
UtahDave / gist:b106dcc802523381854a
Created November 26, 2014 20:07
Use jinja to check for a directory
# NOTE: This example is probably not using the rvm state correctly
# This is just to show how to use jinja to only run a state if
# a path exists
{% set mypath = '/var/my/path' %}
{% if salt['file.exists'](mypath) %}
remove_ruby:
rvm.remove
{% endif %}
@UtahDave
UtahDave / crontab.txt
Created February 28, 2021 07:48 — forked from simonw/crontab.txt
Dogsheep crontab.txt as of 10th September 2020
# Fetch latest configuration:
*/5 * * * * cd /home/ubuntu/dogsheep-config && python3 git_pull_and_run_scripts.py . && sudo python3 ensure_symlinks.py files-to-symlink
# Goodreads
46 * * * * cd /home/ubuntu && /home/ubuntu/datasette-venv/bin/goodreads-to-sqlite books goodreads.db -a auth.json
# Twitter
1,11,21,31,41,51 * * * * /home/ubuntu/datasette-venv/bin/twitter-to-sqlite user-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since
2,7,12,17,22,27,32,37,42,47,52,57 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite home-timeline /home/ubuntu/timeline.db -a /home/ubuntu/auth.json --since
4,14,24,34,44,54 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite mentions-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since
@UtahDave
UtahDave / zoom.md
Created December 17, 2020 21:41 — forked from jordansissel/zoom.md
Zoom on Linux notes

In a zoom?

xdotool search --name "Zoom Meeting ID:"

This will exit non-zero if no meeting matching this name is found. "Zoom Meeting ID:"

This window exists regardless of sharing or not sharing, in my tests.