This file contains hidden or 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
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |
This file contains hidden or 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
| mkdir -p test/libs | |
| git submodule add https://github.com/sstephenson/bats test/libs/bats | |
| git submodule add https://github.com/ztombol/bats-support test/libs/bats-support | |
| git submodule add https://github.com/ztombol/bats-assert test/libs/bats-assert |
This file contains hidden or 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
| # The following will split a CSV (file.csv) into multiple parts of 1 million lines each | |
| # with each part having its own header. | |
| # | |
| # PREFIX denotes the filename to use for the parts. A number will be added to the end. | |
| tail -n +2 file.csv | | |
| split -d -l 1000000 - --filter='sh -c "{ head -n1 file.csv; cat; } > $FILE"' PREFIX |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| SCRUM_TIME=${SCRUM_TIME-"08:45:00"} | |
| BEFORE_DAY=${BEFORE_DAY-$(date +%Y-%m-%d)} | |
| BEFORE_TIME=${BEFORE_TIME-$SCRUM_TIME} | |
| AFTER_DAY=${AFTER_DAY-$(python -c "from datetime import datetime, timedelta; before = datetime.strptime('$BEFORE_DAY','%Y-%m-%d').date(); monday = before.strftime('%u') == '1'; days = -3 if monday else -1; after = before + timedelta(days=days); print after;")} | |
| AFTER_TIME=${AFTER_TIME-$BEFORE_TIME} | |
| TZ_OFFSET=$(date +%z) | |
| AFTER="${AFTER_DAY}T${AFTER_TIME}${TZ_OFFSET}" | |
| BEFORE="${BEFORE_DAY}T${BEFORE_TIME}${TZ_OFFSET}" | |
| DIR="${DIR-$PWD}" |
This file contains hidden or 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 alpine | |
| RUN apk add --update --no-cache nodejs | |
| RUN npm i -g yarn | |
| ADD package.json yarn.lock /tmp/ | |
| ADD .yarn-cache.tgz / | |
| RUN cd /tmp && yarn | |
| RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules |
This file contains hidden or 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
| # Usage: gh-clone lagom lagom to checkout lagom/lagom | |
| function gh-clone() { | |
| OWNERNAME=$1; | |
| PROJNAME=$2; | |
| cd $WORKDIR; | |
| mkdir $PROJNAME; | |
| cd $PROJNAME; | |
| hub init -g | |
| hub clone $OWNERNAME/$PROJNAME master; | |
| cd master; |
This file contains hidden or 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 | |
| # | |
| # chkconfig: 35 95 05 | |
| # description: Hello world application. | |
| # Run at startup: sudo chkconfig hello-world on | |
| # Load functions from library | |
| . /etc/init.d/functions |
This file contains hidden or 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
| 'use strict'; | |
| function getStackOutputs(properties, callback) { | |
| if (typeof properties.StackName === 'undefined') { | |
| return callback(new Error('The StackName property was not specified.')); | |
| } | |
| let filter = []; | |
| if (typeof properties.Filter !== 'undefined') { | |
| if (!Array.isArray(properties.Filter)) { |
This file contains hidden or 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
| tell application "Microsoft Outlook" | |
| activate | |
| set folderName to "Inbox" | |
| if name of selected folder is not equal to folderName then set selected folder to inbox | |
| set selectedMessages to messages of selected folder | |
| repeat with theMessages in selectedMessages | |
| set {year:y, month:m, day:d} to time received of theMessages | |
| set datedFolder to "" & y & "-" & m & "" | |
| if not (exists mail folder datedFolder of on my computer) then | |
| make new mail folder with properties {name:datedFolder} at on my computer |
This file contains hidden or 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 boto3 | |
| import botocore | |
| from random import randint | |
| from time import sleep | |
| def client_throttle(action, **kwargs): | |
| while True: | |
| try: | |
| return action(**kwargs) | |
| except botocore.exceptions.ClientError as e: |