Skip to content

Instantly share code, notes, and snippets.

Jeff Schroeder SEJeff

Block or report user

Report or block SEJeff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .pylintrc
[MASTER]
profile=no
persistent=yes
ignore=migrations
cache-size=500
[BASIC]
# Regular expression which should only match correct module names
module-rgx=([a-z][a-z0-9_]*)$
@SEJeff
SEJeff / init.sls
Last active Aug 29, 2015
States for reproducing salt bug #14497. They are all under services/httpd/ in the states tree
View init.sls
{% from "services/httpd/map.jinja" import httpd with context %}
{% set ltsv_conf = httpd.modconfdir + "/00-ltsv-log-format.conf" %}
httpd:
pkg:
- installed
- name: {{ httpd.pkg }}
service:
- running
- name: {{ httpd.service }}
@SEJeff
SEJeff / hashlib_test.py
Created Aug 15, 2014
Hexdigest on python 2.6 and 2.7
View hashlib_test.py
############################################################################################
>>> sys.version
'2.7.3 (default, Aug 9 2012, 17:23:57) \n[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)]'
>>> for algo in hashlib.algorithms:
... print '{algo} has hexdigest()'.format(instance=getattr(hashlib, algo)(), algo=algo)
...
md5 has hexdigest()
sha1 has hexdigest()
sha224 has hexdigest()
@SEJeff
SEJeff / demonstrate_py26_bug.py
Last active Aug 29, 2015
Python 2.6 bug with IOError in a context manager
View demonstrate_py26_bug.py
#!/usr/bin/env python
from __future__ import print_function
class Context(object):
def __enter__(self):
yield
def __exit__(self, type, value, tracebck):
print("type: {0}".format(str(type(value))))
print("repr: {0}".format(repr(value)))
print("istuple: {0}, isioerror: {1}".format(isinstance(value, tuple), isinstance(value, IOError)))
View AuroraStuff.md

The mustache gotcha

When using “bound” objects in an .aurora file it is an absolute that you do not have spaces in the “mustaches”.

Examples:

  • Bad: {{ profile.my_var }}
  • Good: {{profile.my_var}}

Mesos Slave Constraints

When scheduling a task on aurora with Production=True, the 0.7-incubating scheduler will set a default constraint preventing more than one instance of the task on the same rack.

@SEJeff
SEJeff / debugdjango_function.sh
Created Nov 4, 2010
This is the shell function I use to catch snowy tracebacks when a tomboy sync fails
View debugdjango_function.sh
debugdjango() {
action=${1:-traceback}
port=${2:-8000}
interface=${3:-lo}
TCPDUMP="tcpdump -i${interface} -A port ${port}"
case $action in
all)
echo "INFO: Running tcpdump on interface $interface and port $port" >&2
sudo $TCPDUMP
;;
@SEJeff
SEJeff / cdpy.sh
Created Apr 9, 2011
Shell function for automatically cd-ing into the source directory of any python module much like how you cd in the shell
View cdpy.sh
# Put this in /etc/profile.d/cdpy.sh or copy the function into ~/.bashrc
# Change to the source directory of just about any python module to RTFS
#
# (c) 2011 Jeff Schroeder <jeffschroeder@computer.org> released as GPLv2
cdpy() {
module="$1"
[ -z "$module" ] && return 1
dir=$(python -c "
import os
try:
@SEJeff
SEJeff / atom_feed_gen.py
Created Apr 14, 2011
Atom feed generator
View atom_feed_gen.py
# Copied from the django source but added feed_url so the write actually works.
import sys
from django.utils import feedgenerator
feed = feedgenerator.Atom1Feed(
title=u"Poynter E-Media Tidbits",
link=u"http://www.poynter.org/column.asp?id=31",
feed_url=u"http://rss.feed_url/",
description=u"A group weblog by the sharpest minds in online media/journalism/publishing.",
language=u"en",
@SEJeff
SEJeff / apt.patch
Created Jul 7, 2011
API fix for apt.list_pkgs
View apt.patch
jeff@desktopmonster:~/src/git/salt/salt/modules (misc-fixes)$ gdi apt.py
diff --git a/salt/modules/apt.py b/salt/modules/apt.py
index f3b0cd8..75751a4 100644
--- a/salt/modules/apt.py
+++ b/salt/modules/apt.py
@@ -196,7 +196,7 @@ def upgrade(refresh=True):
return ret_pkgs
-def list_pkgs(regex_string=""):
You can’t perform that action at this time.