Skip to content

Instantly share code, notes, and snippets.

View sodre's full-sized avatar

Patrick Sodré sodre

  • ZeroAE LLC
  • Bethesda, MD
View GitHub Profile
#!/bin/sh
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#

Keybase proof

I hereby claim:

  • I am sodre on github.
  • I am sodre (https://keybase.io/sodre) on keybase.
  • I have a public key ASANbrpK-n-maUbZAcNuxcErg_X9QzAPiBOLPncQFf7_7Qo

To claim this, I am signing this object:

@sodre
sodre / overlay-dir.py
Created June 8, 2019 17:58
shorter version of what is needed for new conda-metapackage
#!/usr/bin/env python
# A Python function for overlaying a source directory on top of a destination dir
import os
import re
from conda_build.utils import merge_tree, _copy_with_shell_fallback
def build_absolute_paths(src, dest, dest_prefix):
abs_src = os.path.abspath(src)
@sodre
sodre / overlay-dir.py
Created June 7, 2019 04:18
Overlay's files on an existing path, overwriting anything that it finds.
#!/usr/bin/env python
# A Python function for overlaying a source directory on top of a destination dir
import os
import shutil
import re
def normalize_paths(dest_prefix, src, dest):
dest = re.sub(r'^/+', '', dest)
return (
@sodre
sodre / overlay-dir.py
Created June 7, 2019 03:10
Simple python code for overlaying a source directory on top of another (existing) dir.
# A Python function for overlaying a source directory on top of a destination dir
import os
import shutil
def overlay_dir(prefix, src, dest):
abs_src = os.path.abspath(src)
abs_dest = os.path.join(prefix, dest)
for root, dirs, files in os.walk(abs_src):
@sodre
sodre / bump
Created July 4, 2017 02:51 — forked from colby/bump
Bumps a git tag and metadata.rb version for a given Chef cookbook, follows SemVer standards.
#!/bin/bash
set -eo pipefail
semver_regex="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
usage="\
Usage:
$0
$0 show
@sodre
sodre / airflow-extras.yaml
Created May 4, 2017 00:32
Airflow 1.8.0 Extras
cgroups:
- cgroupspy>=0.1.4
cloudant:
- cloudant>=0.5.9,<2.0
crypto:
- cryptography>=0.9.3
datadog:
- datadog>=0.14.0
docker:
- docker-py>=1.6.0
@sodre
sodre / tun-remote-ip.sh
Created January 8, 2017 20:32
Vyatta / VyOS / EdgeOS script for setting tunnel remote-ip based on a given hostname.
#!/bin/vbash
# sets the tunnel remote-ip based on the supplied host-name.
if [ $# == 0 ]; then
echo "usage: $0 <tunnel> <host-name>"
echo " e.g.: $0 tun0 vpn-01.no-ip.com"
exit 1
fi
tunnel=$1
@sodre
sodre / hxexsa.json
Last active September 25, 2016 05:05 — forked from drscream/linux-vm.json
{
"brand": "kvm",
"alias": "hxexsa",
"resolvers": [
"8.8.8.8",
"8.8.4.4"
],
"ram": "12288",
"vcpus": "2",
"nics": [
@sodre
sodre / pkgin.update.repo.sh
Created May 30, 2016 03:42 — forked from typomedia/pkgin.update.repo.sh
Pkgin Repository Update Script
#!/bin/sh
# Copyright 2014 Typomedia Foundation. All rights reserved.
# Released under GPL version 3.
#
# Pkgin Repo Update Script v1.0alpha
# Update repositories.conf for pkgin, and set $PKG_PATH for pkg_add
export PKG_PATH=http://pkgsrc.joyent.com/packages/SmartOS/2014Q1/x86_64/All
echo $PKG_PATH > /opt/local/etc/pkgin/repositories.conf