Skip to content

Instantly share code, notes, and snippets.

View toast38coza's full-sized avatar

Christo Crampton toast38coza

View GitHub Profile
@toast38coza
toast38coza / jenkins-webhook.json
Created June 24, 2015 07:48
Creating github service webhooks with Ansible uri_module
{
"name": "jenkins",
"active": true,
"events": [
"push"
],
"config": {
"jenkins_hook_url": "http://ci.jenkins-ci.org/github-webhook/"
}
}
@toast38coza
toast38coza / pandas-snippets.py
Last active October 9, 2015 15:40
Some useful snippets for analyzing data with pandas
"""
DataFrame:
project_id hours overtime day
0 3 4 False 2015-10-07
1 3 6 False 2015-10-07
2 3 7 False 2015-10-07
3 2 5 False 2015-10-07
4 2 4 False 2015-10-07
5 1 4 False 2015-10-07
@toast38coza
toast38coza / .travis
Last active October 30, 2015 11:03
Travis script for testing an Ansible playbook
---
language: python
python: "2.7"
env:
- SITE=test.yml
before_install:
- sudo apt-get update -qq
- hosts: localhost
vars:
- kong_admin_base_url: "http://api.example.com:8001"
- kong_base_url: "http://api.example.com:8000"
- kong_consumers:
- username: Jason
key: 123
tasks:
- name: Register APIs
@toast38coza
toast38coza / pre-push
Created February 5, 2016 08:26
pre-push hook. Run django tests inside docker before pushing
#!/bin/bash
docker-compose run web python manage.py test
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo ""
echo ""
echo "\******************"
echo "Oh hell no!"
echo "The tests have failed. Cancelling push"
echo "------------------"
@toast38coza
toast38coza / docker-cleanup.yml
Created February 8, 2016 20:46
Some commands for cleaning up after Docker
# hat-tip: http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/
# cleanup docker:
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
@toast38coza
toast38coza / github_repo.py
Created February 9, 2016 18:05
An Ansible module for managing github repos
#!/usr/bin/python
DOCUMENTATION = '''
---
module: github_repo
short_description: Manage your repos on Github
'''
EXAMPLES = '''
- name: Create a github Repo
@toast38coza
toast38coza / docker.yml
Created February 25, 2016 08:10
Ansible playbook to install docker toolbox on Ubuntu 14.04
---
- hosts: localhost
tasks:
- name: Update apt
apt:
update_cache: yes
become: yes
become_user: root
become_method: sudo
@toast38coza
toast38coza / logstash_simplest_example.conf
Created March 15, 2016 07:11
The simplest configuration for testing logstash filters
input{ stdin { } }
output { stdout { codec => rubydebug } }
@toast38coza
toast38coza / logstash_custom_filter.conf
Last active March 15, 2016 15:08
An example of creating a custom filter to parse a log file that is not in a standardized format
input {
stdin { }
}
filter {
grok {
match => { "message" => "%{DATE:date}[- ]%{TIME:time} - %{WORD:status}: %{GREEDYDATA:state}"}
}