Skip to content

Instantly share code, notes, and snippets.

View taion809's full-sized avatar
:shipit:
what are statuses for?

Nicholas Johns taion809

:shipit:
what are statuses for?
View GitHub Profile
@taion809
taion809 / Dockerfile
Last active December 21, 2015 13:49
Dockerfile for building an nginx webserver from nginx.org's mainline repo
# nginx mainline from the nginx.org apt repository as of this gist 1.5.3
#
#
# Version 0.1
#
# Build instructions:
# sudo docker build -t="nginx" .
#
# Usage:
# sudo docker -d nginx
FROM ubuntu
MAINTAINER Nicholas Johns
RUN echo "deb http://archive.ubuntu.com/ubuntu precise universe" > /etc/apt/sources.list.d/universe.list
RUN apt-get update; apt-get install -y -q wget curl python-software-properties libonig2 libqdbm14
RUN add-apt-repository ppa:ondrej/php5
RUN wget -qO - http://nginx.org/keys/nginx_signing.key | apt-key add -
@taion809
taion809 / gist:6396566
Created August 31, 2013 06:29
socat listen unix socket
<hashdash> i've found socat to be an obscurish/unix-unfriendly but useful tool for quick debugs of what something like docker is doing on the wire
<hashdash> for unix sockets, even:
<hashdash> socat -v UNIX-LISTEN:listener,fork UNIX:/var/run/docker.sock
@taion809
taion809 / gist:6510212
Created September 10, 2013 14:29
PHP Nested set to multidimensional array
private function _formatTreeIntoArray(&$tree, $current_depth = 0)
{
$formattedTree = array();
while($leaf = current($tree))
{
if($leaf->DEPTH > $current_depth)
{
$formattedTree[] = $this->_formatTreeIntoArray($tree, $leaf->DEPTH);
}
elseif($leaf->DEPTH < $current_depth)
@taion809
taion809 / gist:6520897
Created September 11, 2013 08:40
flat nested set to bootstrap 2.3 nested menu
<?php
$current_depth = 1;
$html = '';
foreach($menu as $key => $value)
{
if(isset($menu[$key+1]) && $menu[$key+1]->DEPTH > $current_depth)
{
if($current_depth > 1)
{
@taion809
taion809 / split_dbdump
Created September 18, 2013 02:46
split sql dump add transaction
#!/bin/sh
split -l 5000 dbdump.sql
find ./x* -type f -print0 | while IFS= read -r -d '' filename;\
do sed -i '1s/^/\n\nSET FOREIGN_KEY_CHECKS=0;\nSET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\nSET AUTOCOMMIT = 0;\nSET time_zone = \"+00:00\";\nSTART TRANSACTION;\n\n /' $filename;\
done
find ./x* -type f -print0 | while IFS= read -r -d '' filename;\
do sed -i '$s/$/\n\nCOMMIT;\nSET FOREIGN_KEY_CHECKS=1;\n\n /' $filename;\
done
@taion809
taion809 / Piecrust_Dockerfile
Created October 5, 2013 14:26
Piecrust Dockerfile
# The purpose of this Dockerfile is to serve as the base for a static website, in this case redstalker.com
# There are better ways to do this
# For example, using a volume and only running the redstalker.com Dockerfile in the case of update.
FROM johnsn/rs-nginx
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force updating ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update; apt-get upgrade -y; apt-get install -y wget python-software-properties
@taion809
taion809 / Redstalker_Single_Dockerfile
Created October 5, 2013 14:31
Redstalker.com Docker file if using a single docker container for piecrust, nginx, and the static site.
# This Dockerfile relies on johnsn/rs-nginx and johnsn/rs-piecrust
# It is better to use a volume and then use a Docker container as a binary to generate the
# static site vs inheriting multiple services
FROM johnsn/rs-piecrust
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force updating ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update; apt-get upgrade -y
@taion809
taion809 / Dockerfile
Last active December 24, 2015 19:19
Project specific Nginx
FROM ubuntu
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
#Force updating ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update; apt-get upgrade -y; apt-get install -y wget
#Add nginx certificate and sources
RUN wget -qO - http://nginx.org/keys/nginx_signing.key | apt-key add -
RUN echo "deb http://nginx.org/packages/mainline/ubuntu/ precise nginx" > /etc/apt/sources.list.d/nginx.list
@taion809
taion809 / Dockerfile
Created October 6, 2013 05:52
Apache and PHP5.5 On Docker
FROM ubuntu
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force update
# install wget, curl, and python-software-properties for adding PPA's
# curl and python-software-properties are not necessary but I like them.
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update; apt-get upgrade -y; apt-get install -y wget curl python-software-properties
# Let's install php 5.5