Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
#!/bin/bash
curl -sSk http://192.168.11.10:8000 \
-b ./cookies.txt \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-d '[{
"client": "local_async",
"tgt":"overlord",
"fun":"state.sls",
"kwarg": { "mods": "test.s_test-state1" }
@UtahDave
UtahDave / git-serve.md
Created August 1, 2017 22:23 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

nginx:
pkg.installed: []
service.running:
- require:
- pkg: nginx
php-fpm:
pkg.installed: []
service.running:
- name:
- require:
- pkg: php-fpm
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Release -O /tmp/Release.xyz
if test /tmp/Release.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
@UtahDave
UtahDave / jqfilter.sh
Created May 27, 2016 18:03 — forked from deybhayden/jqfilter.sh
jq filter a list of objects' values
aws elasticbeanstalk describe-configuration-settings --application-name foo --environment-name foo-staging | jq '.ConfigurationSettings[0].OptionSettings[] | select(.OptionName=="Notification Topic ARN")'
{% for server, addrs in salt['mine.get']('roles:docker', 'network.ip_addrs', expr_form='grain').items() %}
{% if '*web1*' in server %}
server {{ server }} {{ addrs[0] }}:443 check inter 2000 rise 2 fall 5
{% endif %}
{% endfor %}
@UtahDave
UtahDave / System Design.md
Created April 20, 2016 21:30 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@UtahDave
UtahDave / salt-msi-instructions.md
Created March 18, 2016 20:23
How to build Windows Installer (MSI) packages for SaltStack

Build environment (in order):

  • Microsoft Windows Server 2008 R2 Standard w/ SP1
  • Microsoft Visual Studio 2008 (all features)
  • Microsoft Windows SDK for Windows 7 and .NET Framework 4 (all features)
  • Python 2.7.11 (all features, skip byte compilation of .py files)
  • Run WindowsSdkVer.exe -version:v7.1 as an administrator in order to register the SDK properly with Visual Studio 2008.
  • Run pip install -U setuptools as an administrator in order to update the bundled version of setuptools.
  • Patch distutils per http://bugs.python.org/issue15797.

Obtaining sources:

@UtahDave
UtahDave / Documentation.md
Created January 29, 2016 23:38 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs