Skip to content

Instantly share code, notes, and snippets.

@alexhayes
alexhayes / building-install
Created June 4, 2012 07:44
Install rsync and php4-domxml on old Debian
#!/bin/bash
V30=`grep "3.0" /etc/issue`
V31=`grep "3.1" /etc/issue`
V4=`grep "4." /etc/issue`
V5=`grep "5." /etc/issue`
V6=`grep "6." /etc/issue`
UPDATE_SOURCES=1
if [ "$V30" != "" ]; then
@alexhayes
alexhayes / switch-apt-sources.sh
Created June 5, 2012 06:48 — forked from simonexmachina/building-install.sh
Switch apt source to next distro - basically so we can get a working php4-domxml installed
#!/bin/bash
V30=`grep "3.0" /etc/issue`
V31=`grep "3.1" /etc/issue`
V4=`grep "4." /etc/issue`
V5=`grep "5." /etc/issue`
V6=`grep "6." /etc/issue`
UPDATE_SOURCES=1
if [ "$V30" != "" ]; then
@alexhayes
alexhayes / building-install-check.sh
Created June 6, 2012 00:15 — forked from simonexmachina/building-install-check.sh
Test that rsync and php4-domxml are working on old Debian
#!/bin/bash
EXIT_STATUS=0
# Test that domxml is installed
php -r "domxml_version();" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\a#### Error: php4-domxml not loaded ####"
EXIT_STATUS=1
fi
@alexhayes
alexhayes / SupervisordInstallationUbuntu12.04LTS.md
Last active April 7, 2020 14:20
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash < <(curl https://gist.githubusercontent.com/alexhayes/814fd0d0f7020e918a95/raw/full-install.sh)
@alexhayes
alexhayes / README.md
Last active August 29, 2015 14:11
Require using sls fails

I'm attempting to have a state depend on another state (state 'chaining' as outlined here)

In my example I have an include for the 'php' formula.

On line 14 of init.sls you can see - sls: php which is supposed to ensure that state install-pear depends on the php state which is derived from php.init.sls (included below for clarity).

When I execute salt foo state.highstate test=True I receive the following:

foo:
@alexhayes
alexhayes / README.md
Last active August 29, 2015 14:11
SLS require that only has an include fails

It appears that if you have a require with sls: foo and foo.sls itself only has include: statements the requirement fails.

When the command salt \* state.highstate test=True the following is output;

example.com:
----------
          ID: eggs
    Function: cmd.run
 Name: echo "I should be required..."
@alexhayes
alexhayes / doesnt-work.log
Created March 3, 2015 22:29
Celery task signature passed as dict
[2015-03-04 09:15:15,852: INFO/MainProcess] Received task: meh.tasks.a[ac7bb67f-5cc2-4c38-8608-66bf7dbdd7c1]
[2015-03-04 09:15:15,852: INFO/MainProcess] Received task: meh.tasks.a[d252459b-87d7-4ed5-a73d-af30eb748317]
[2015-03-04 09:15:15,852: INFO/MainProcess] Received task: meh.tasks.a[9d628c31-2529-40e7-8e94-09a93351b5e5]
[2015-03-04 09:15:15,853: INFO/MainProcess] Received task: meh.tasks.a[a07b2dff-089b-40cb-8f2a-c17011296db3]
[2015-03-04 09:15:15,854: WARNING/Worker-8] ~~~A~~~
[2015-03-04 09:15:15,854: WARNING/Worker-7] ~~~A~~~
[2015-03-04 09:15:15,854: WARNING/Worker-4] ~~~A~~~
[2015-03-04 09:15:15,854: WARNING/Worker-8] 3
[2015-03-04 09:15:15,854: WARNING/Worker-7] 2
[2015-03-04 09:15:15,854: WARNING/Worker-4] 1
@alexhayes
alexhayes / celery.py
Last active August 29, 2015 14:22
Setup celery logging with worker name in format
from celery.signals import celeryd_init, after_setup_task_logger
app = Celery('myapp')
# ...
# ...
# ...
@celeryd_init.connect
def configure_workers(sender=None, conf=None, **kwargs):
@alexhayes
alexhayes / README.md
Created June 15, 2015 02:01
Celery Model Serializer

Usage

app = Celery('myapp')

@app.task(serializer='django-model')
def test(x):
    print x
    
obj = MyModel.objects.get(pk=12)
@alexhayes
alexhayes / .multitailrc
Last active September 8, 2021 08:57
multitail python log formatting
colorscheme:python-log
cs_re_s:blue:[DEBUG|INFO|WARNING|CRITICAL|ERROR] ([a-z\.0-9\_]+):
cs_re_s:white,magenta,bold:(\sDEBUG\s)
cs_re:magenta:.*DEBUG.*
cs_re_s:white,green,bold:(\sINFO\s)
cs_re:green:.*INFO.*
cs_re_s:white,yellow,bold:(\sWARNING\s)
cs_re:yellow:.*WARNING.*
cs_re_s:white,red,bold:(\sCRITICAL\s)
cs_re:red:.*CRITICAL.*