Skip to content

Instantly share code, notes, and snippets.

@tim-tang
tim-tang / IPaddr
Created May 20, 2016 09:15 — forked from vincepii/IPaddr
#!/usr/gnu/bin/sh
#
# License: GNU General Public License (GPL)
# Support: linux-ha@lists.linux-ha.org
#
# This script manages IP alias IP addresses
#
# It can add an IP alias, or remove one.
#
# usage: $0 {start|stop|status|monitor|validate-all|meta-data}

Run Netatalk in a SmartOS zone

This guide is based on this blog post: http://blog.smartcore.net.au/blazingly-fast-afp-on-a-smartos-zone/.

Import image and create virtual machine

Find the latest image, in this case 4166f6d6-ea5f-11e4-addd-8351b159d9b6 (15.1.0), or 24648664-e50c-11e4-be23-0349d0a5f3cf (14.4.1) if you need Long Term Support (LTS).

# imgadm avail | grep base-64
@tim-tang
tim-tang / test_dags.py
Created October 28, 2016 11:25 — forked from criccomini/test_dags.py
test_dags.py
import os
import unittest
from airflow.models import DagBag
class TestDags(unittest.TestCase):
"""
Generic tests that all DAGs in the repository should be able to pass.
"""
@tim-tang
tim-tang / run-tests.sh
Created October 28, 2016 11:30 — forked from criccomini/run-tests.sh
run-tests.sh
#!/bin/bash
# Runs airflow-dags tests.
# Set Nose defaults if no arguments are passed from CLI.
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
NOSE_ARGS=$@
if [ -z "$NOSE_ARGS" ]; then
NOSE_ARGS=" \
--with-coverage \
@tim-tang
tim-tang / airflow_eg.py
Created October 29, 2016 09:08 — forked from abridgett/airflow_eg.py
airflow XCOM notification example
MAP_SLACK_ATTACHMENTS = [
{
"fallback": "{{params.map}} {{ task_instance.xcom_pull(task_ids=params.map, key='slack_status') }}",
"pretext": "{{params.map}} update {{ task_instance.xcom_pull(task_ids=params.map, key='slack_status') }}",
"fields": [
{
"title": "Copied",
"value": "{{ task_instance.xcom_pull(task_ids=params.map, key='copied') }}",
"short": True
}
@tim-tang
tim-tang / slack.py
Created October 29, 2016 10:49 — forked from boxysean/slack.py
PythonSlackOperator -- how I've integrated notifications into my PythonOperators
# airflow/plugins/slack.py
import logging
from airflow.operators.python_operator import PythonOperator
from airflow.plugins_manager import AirflowPlugin
from slackclient import SlackClient
from titan.utils import config