Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
@UtahDave
UtahDave / winenv.py
Created January 5, 2012 09:09 — forked from ssokolow/winenv.py
Helpers for permanent modifications to the Windows environment
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Helpers for automating the process of setting up ported Linux/UNIX
applications which were designed with expectations like being in $PATH.
@note: Basic functionality requires only the Python standard library.
Some functions and methods also require the PyWin32 package.
@note: A much more verbose "sudo for Windows" implementation (BSD-licensed)
@UtahDave
UtahDave / djangomodule.py
Created January 28, 2012 14:35 — forked from fatbox/djangomodule.py
Load Django modules from within a Salt module
"""
This allows you to import Django modules into a Salt module
"""
import logging
import sys
import os
log = logging.getLogger(__name__)
@UtahDave
UtahDave / ldsconf.py
Created April 2, 2012 02:17 — forked from travisbhartwell/ldsconf.py
Python Script to download October 2011 General Conference Archives
#!/usr/bin/python
"""
This is a handy script to download the media from General Conference for
your own use. Execute this script with the appropriate options to download the
files you wish.
The only non-Python standard library dependency is BeautifulSoup.
Example invocation:
@UtahDave
UtahDave / module.sls
Created June 11, 2012 20:30 — forked from anonymous/module.sls
Apache module macro for salt
{% macro a2mod(module, enabled=true) -%}
{% if enabled %}
a2enmod {{ module }}:
cmd:
- run
- unless: test -L /etc/apache2/mods-enabled/{{ module }}.load
- require:
- pkg: apache2
- watch_in:
- service: apache2
@UtahDave
UtahDave / gist:3196443
Created July 29, 2012 06:43 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@UtahDave
UtahDave / password_hashing_api.md
Created September 13, 2012 23:40 — forked from nikic/password_hashing_api.md
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

@UtahDave
UtahDave / gist:3785726
Created September 26, 2012 02:51
Salt Output -- I love success in the morning!
root@ubuntu:/srv/salt# salt salt-minion state.highstate
salt-minion:
----------
State: - cmd
Name: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
Function: run
Result: True
Comment: Command "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C" run
Changes: pid: 10413
retcode: 0
@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 / pillar-data
Created October 22, 2012 15:12 — forked from unicolet/pillar-data
manage snmpd with salt
snmp_ro_community: xxxxxxx
snmp_management_station: 10.0.0.1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Salt returner that report error back to sentry
"""
import logging
try: