Skip to content

Instantly share code, notes, and snippets.

View jay-johnson's full-sized avatar

Jay jay-johnson

View GitHub Profile
@jay-johnson
jay-johnson / CJE-DockerContainerTester.groovy
Last active July 13, 2016 21:52
CloudBees Jenkins Docker Pipeline
node {
// Setup the Docker Registry (Docker Hub) + Credentials
env.REGISTRY_URL = "https://index.docker.io/v1/" // Docker Hub
env.DOCKER_CREDS_ID = "jayjohnson-DockerHub" // name of the Jenkins Credentials ID
env.BUILD_TAG = "testing" // default tag to push for to the registry
stage 'Checking out GitHub Repo'
git url: 'https://github.com/jay-johnson/docker-django-nginx-slack-sphinx.git'
@jay-johnson
jay-johnson / Python Date Transformations.md
Last active June 4, 2016 02:42
Python Date Transformations

A list of python data transformations

String to Datetime

  1. String to Datetime and then compare
#!/usr/bin/python

import datetime
@jay-johnson
jay-johnson / Downloading all Debian Packages from a Repo
Created April 27, 2016 21:08
Downloading all Debian Packages from a Repo
#!/bin/bash
repo="<DEBIAN REPO FQDN>"
outputDir="<DIRECTORY TO STORE DEBIAN FILES>"
arch="<ARCH like binary-i386 or binary-amd64>"
echo "Download All Debs from Repository($repo) to dir($outputDir)"
pushd $outputDir >> /dev/null
packagenames=`wget -q -O - http://$repo/pool/main/h | grep deb | grep href | sed -e 's/\/"/ /g' | sed -e 's/"/ /g' | awk '{print $3}'`
@jay-johnson
jay-johnson / Setting up X11 for use on an EC2 host.md
Last active January 20, 2024 02:37
Setting up X11 for use on an EC2 host

Run this on EC2 host

  1. Set these attributes in /etc/ssh/sshd_config
# cat /etc/ssh/sshd_config  | grep X11
X11Forwarding yes 
X11DisplayOffset 10
X11UseLocalhost yes 
@jay-johnson
jay-johnson / Change the Compose File without having to Rebuild the Container.md
Last active January 4, 2017 23:47
Change the Compose File without having to Rebuild the Container

Clone the Repo

$ git clone https://github.com/jay-johnson/docker-schema-prototyping-with-mysql.git

Start the Composition

$ ./start_composition.sh 
@jay-johnson
jay-johnson / docker-compose.yml
Last active April 13, 2016 03:33
Docker Compose - Schema Prototyper Example
version: '2'
services:
db:
image: jayjohnson/schemaprototyping
container_name: "schemaprototyping"
hostname: "mysql1"
networks:
- dbprototyping
environment:
@jay-johnson
jay-johnson / Debugging Database Schema Creation.md
Last active April 11, 2016 05:11
Debugging Database Schema Creation
[root@mysql1 db-loaders]# cat /tmp/dbreload.log

Creating Database(stocks) on Env(Local)

Dropping Targeted Database(stocks) Address(127.0.0.1) User(dbadmin) Pass(dbadmin123) Schema(/opt/db-loaders/schema/db_schema.py) Init(/opt/db-loaders/schema/initialize_db.py)
/opt/db-loaders/schema/drop_database.sh stocks dbadmin 127.0.0.1 dbadmin123 3306
Creating Targeted Database(stocks) Address(127.0.0.1) User(dbadmin) Pass(dbadmin123) Schema(/opt/db-loaders/schema/db_schema.py) Init(/opt/db-loaders/schema/initialize_db.py)
/opt/db-loaders/schema/create_database.sh stocks dbadmin 127.0.0.1 dbadmin123 3306
Adding Records with Initializer(/opt/db-loaders/schema/initialize_db.py)
@jay-johnson
jay-johnson / Changing the Container's Configuration by editing the Compose file.md
Created April 11, 2016 05:10
Changing the Container's Configuration by editing the Compose file
$ cat docker-compose.yml | grep "=" | sort
- DATADIR=/var/lib/mysql
- DBADDRESS=127.0.0.1
- DBHOST=127.0.0.1
- DBINITIALIZER=/opt/db-loaders/schema/initialize_db.py
- DBNAME=stocks
- DBPASS=dbadmin123
- DBPORT=3306
- DBSCHEMA=/opt/db-loaders/schema/db_schema.py
@jay-johnson
jay-johnson / Verify MySQL Connectivity from inside the Container.md
Created April 11, 2016 05:09
Verify MySQL Connectivity from inside the Container
$ ./ssh.sh
SSH-ing into Docker image(schemaprototyping)
[root@mysql1 db-loaders]# /opt/db-loaders/bin/verify_mysql_user.sh
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 5.6.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
@jay-johnson
jay-johnson / Verify the Container's Database using the MySQL CLI.md
Created April 11, 2016 05:08
Verify the Container's Database using the MySQL CLI
$ ./verify_mysql_user.sh
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its