This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Relies on having fixvirtualenv : https://gist.github.com/nathairtras/7b2df168d9a919b4e644b1d7da0aa05d | |
# Ensure virtualenv script exists | |
if [ -z $VIRTUALENVWRAPPER_SCRIPT ] | |
then | |
echo "VirtualEnvWrapper Script Environment Variable Not Found. Please run `pip3 install virtualenvwrapper` to continue." | |
exit 1 | |
fi | |
# Ensure WORKON_HOME set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# @@TODO: Script assumes Python3. If you are wanting to fix a Python2 Virtual Environment, | |
# consider adding a command line argument to specify which python to use and adjust the `mkvirtualenv` line. | |
# Reminder: Python2 is EOL Jan1 2020, so script assumes you wouldn't want to do that... | |
# Ensure virtualenv script exists | |
if [ -z $VIRTUALENVWRAPPER_SCRIPT ] | |
then | |
echo "VirtualEnvWrapper Script Environment Variable Not Found. Please run `pip3 install virtualenvwrapper` to continue." | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pytds | |
# Grabbing the user and password from environment variables | |
# Load these however you would like | |
server = os.environ["MSSQL_SERVER"] | |
user = os.environ["MSSQL_USER"] | |
password = os.environ["MSSQL_PASS"] | |
# Fake some rows, these could be from CSV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# List of phrases | |
phrases = ["computer science","lots of fun"] | |
# Text to parse | |
paper_text = """ | |
This is a sentence that includes the phrase computer science. Computer science is fun. | |
Writing code is lots of fun. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { background: #222; color: #e6e6e6; } | |
a { color: #949494; } | |
a:link, a:visited { color: #949494; } | |
a:hover, a:active, a:focus { color: #c7c7c7; } | |
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import settings | |
from airflow.hooks import BaseHook | |
from airflow.models import Connection | |
# Start a session | |
session = settings.Session() | |
# Create a new connection - these are not unique by name! | |
cnx_kwargs = { | |
"conn_id": "mssql_named", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from airflow.models import DagBag | |
def callback_subdag_clear(context): | |
"""Clears a subdag's tasks on retry.""" | |
dag_id = "{}.{}".format( | |
context['dag'].dag_id, | |
context['ti'].task_id, | |
) | |
execution_date = context['execution_date'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
TMUX_VERSION=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:Get*", | |
"s3:List*" | |
], | |
"Resource": [ |