Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
@ssokolow
ssokolow / winenv.py
Created June 5, 2011 21:55
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)
@dangarthwaite
dangarthwaite / elasticsearch.yml
Created December 3, 2012 22:43
salt state for elasticsearch on squeeze
# vim: ft=yaml
cluster.name: {{ ES_CLUSTER_NAME }}
node.name: {{ grains['id'] }}
network.host: {{ salt['cmd.run']('awk \'/192.168/ {print $2}\' /etc/network/interfaces') }}
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.1.2", "192.168.1.3"]
@lithid
lithid / Grid
Created February 20, 2013 02:05
Here is a grid using python and GTK3, loading dynamically based on window size/re-size. I came up with this example while trying to mimic a gridview of images for a wallpaper application. The example is below.
#!/usr/bin/env python2
from gi.repository import Gtk
class Grid(Gtk.Window):
widget_list = []
WIDGET_SIZE = 140
COLS = 1
NUM = 100
def calcule_columns(self, scroll, grid):
@auser
auser / database.yml
Last active August 25, 2016 23:57
The first iteration of a `deploy` module for saltstack
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
@auser
auser / informer.py
Last active December 15, 2015 04:29
"""
This enables us to call the minions and search for a specific role
"""
import logging
# Import salt libs
import salt.utils
import salt.payload
@hdonnay
hdonnay / mk_freeze.sh
Last active December 18, 2015 00:59
Helper script to use esky with salt
#!/bin/sh
trap '[ -f patch.$$ ] && patch -R < patch.$$' 0
PATH="$PATH:`pwd`/patchelf/src"
set -e
#exec >/dev/null
[ -f setup.py ] || { printf "You seem to be in the wrong directory.\n"} >&2; exit 1; }
if ! which patchelf >/dev/null 2>&1; then
printf "Couldn't find 'patchelf', going to download and compile.\n" >&2
git clone https://github.com/NixOS/patchelf
(
@godber
godber / gist:5777861
Last active December 18, 2015 11:48
A Salt SLS Module for managing a per host /etc/salt/minion.d/grains.conf file based on matching host IDs. If there is a host.conf file, that will be used, if not, then default.conf will be used.
salt-minion:
pkg:
- installed
service:
- running
- require:
- pkg: salt-minion
- watch:
- file: /etc/salt/minion.d/grains.conf
{# localhost_present_host:}
# host.present:
# - ip: 127.0.0.1
# - name: {{ grains['id'] }} #}
local_address_host:
host.absent:
- ip: 127.0.1.1
{% if grains['ec2_local-ipv4'] is defined -%}
@whiteinge
whiteinge / formula-util.sh
Last active June 28, 2017 16:45
Functions to more easily work with a ton of organization repos
#!/bin/bash
# Functions to more easily work with a ton of organization repos
#
# Requires ok.sh and Git.
#
# Available commands: ${ALL_FUNCS}
# Lazyness!
ok="$(which ok.sh)"
eval "$(awk '$0 ~ /^_helptext/, /^}/ { print }' $ok)"
@andreagrandi
andreagrandi / gdata_read.py
Last active October 30, 2019 22:30
Read a Google Docs spreadsheet document from Python.
# Copyright (c) 2013, Andrea Grandi and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,