Skip to content

Instantly share code, notes, and snippets.

@thetemplateblog
thetemplateblog / docker_LAMP.md
Created July 31, 2016 01:23 — forked from porjo/docker_LAMP.md
Minimal Centos 6.4 LAMP stack running on Docker (Ubuntu 13.04 host). End result is running httpd and port 80 is forwarded through from host to container.

Installation

sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo apt-get install linux-image-extra-`uname -r`
sudo sh -c "curl http://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker
@thetemplateblog
thetemplateblog / chef-insert-line-if-no-match.rb
Created August 26, 2016 12:59 — forked from clarkdave/chef-insert-line-if-no-match.rb
[CHEF] Insert a line in a file if it doesn't already exist
line = '127.0.0.1 gateway.internal gateway'
file = Chef::Util::FileEdit.new('/etc/hosts')
file.insert_line_if_no_match(/#{line}/, line)
file.write_file
import os
import boto.utils
import boto3
import requests
import datetime
import time
def get_contents(filename):
### autoscale.tf
data "template_file" "userdata" {
template = "${file("templates/userdata.tpl")}"
vars {
region = "${var.region}"
file_system_id = "${aws_efs_file_system.prod-efs.id}"
}
}
resource "aws_launch_configuration" "mig5-prod-lc" {
@thetemplateblog
thetemplateblog / test.java
Created August 2, 2018 16:37
TestSelenium
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class Testclass
@thetemplateblog
thetemplateblog / gunicorn_start.bash
Created December 3, 2018 00:28 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@thetemplateblog
thetemplateblog / htpasswd.py
Created December 7, 2018 11:57 — forked from guerrerocarlos/htpasswd.py
Python script for generating htaccess passwords
#!/usr/bin/python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@thetemplateblog
thetemplateblog / update.sh
Created May 7, 2019 19:46 — forked from mslinn/update.sh
Bash Script to Update all Git Directories Below Current Directory or Specified Directory
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
# Update all git directories below current directory or specified directory
# Skips directories that contain a file called .ignore
#
# Using printf insteach of echo -e for Mac OS
# See http://stackoverflow.com/questions/4435853/echo-outputs-e-parameter-in-bash-scripts-how-can-i-prevent-this
@thetemplateblog
thetemplateblog / gitlab-sync-projects
Created August 6, 2019 15:28 — forked from elferink/gitlab-sync-projects
Gitlab: Clone / Pull all projects in a group
#!/bin/sh
# Source
# https://gist.github.com/JonasGroeger/1b5155e461036b557d0fb4b3307e1e75
# API Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
GITLAB_URL="https://{GITLAB_URL}/"
GITLAB_PRIVATE_TOKEN=""
NAMESPACE="$1"
@thetemplateblog
thetemplateblog / docker_backup.py
Created July 21, 2020 12:28 — forked from firecat53/docker_backup.py
Backup docker volumes
#!/usr/bin/env python3
"""Backs up and restores data-only volumes to/from host backup directory using
rsync. Only backup named volumes, which is arbitrarily set to ones having a name
length < 40 characters.
1. Create a Docker image containing rsync (named rsync)
https://github.com/firecat53/dockerfiles/tree/master/rsync
``docker build -t rsync .``