Skip to content

Instantly share code, notes, and snippets.

View dmulter's full-sized avatar

David Multer dmulter

View GitHub Profile
@dmulter
dmulter / test_common.py
Created July 15, 2019 01:28
pytest code
def get_fixture(name):
module = import_module('.conftest', 'tests')
return getattr(module, name)()
import * as React from 'react';
import { Component } from 'react';
import { Button, ButtonProps, Label } from 'semantic-ui-react';
import * as uuid from 'uuid';
export class FileButton extends Component {
constructor(props) {
super(props);
Pull latest base images...
Using default tag: latest
latest: Pulling from library/alpine
Digest: sha256:46e71df1e5191ab8b8034c5189e325258ec44ea739bba1e5645cff83c9048ff1
Status: Image is up to date for alpine:latest
mainline-alpine: Pulling from library/nginx
Digest: sha256:385fbcf0f04621981df6c6f1abd896101eb61a439746ee2921b26abc78f45571
Status: Image is up to date for nginx:mainline-alpine
Build app image...
FROM alpine
EXPOSE 8080
LABEL "com.datadoghq.ad.logs"='[{"source": "api"}]'
# configure environment
ENV PYTHONUNBUFFERED 1
# update and install packages
RUN apk update --no-cache && \
function cd {
builtin cd "$@"
if [ -d ".virtualenv" ] ; then
source .virtualenv/bin/activate
fi
}
# custom prompt
. ~/bin/dev-prompt.sh
# variables
set -o vi -o noclobber -o ignoreeof
export EDITOR=vim
# aliases
alias rm='rm -i'
alias cp='cp -i'
# Configure Git
git config --global fetch.prune true
git config --global push.default simple
git config --global branch.autosetuprebase always
git config --global diff.submodule log
# Configure Git aliases
git config --global alias.st 'status'
git config --global alias.ci 'commit'
git config --global alias.co 'checkout'
@dmulter
dmulter / dev-prompt.sh
Created February 8, 2018 18:47
PS1 setting for Python/Git
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
#
# USAGE:
FROM ubuntu:14.04
# update packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get install -y python python-dev python-pip g++ libffi-dev libssl-dev make nginx supervisor && \
pip install --upgrade pip
@dmulter
dmulter / saveredis.sh
Created January 5, 2015 23:17
blocking redis bgsave
#!/bin/sh
# background save Redis data
lsave=`redis-cli lastsave`
redis-cli bgsave
while [ $lsave -eq `redis-cli lastsave` ]; do
sleep 5
done