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 / iris_random_forest_cm.py
Created November 11, 2016 20:17
Random Forest Classifier with Pandas-ML for generating a nice looking Confusion Matrix using the Iris dataset
#!/usr/bin/python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import confusion_matrix
from sklearn.ensemble import RandomForestClassifier
from pandas_ml import ConfusionMatrix # https://github.com/pandas-ml/pandas-ml/
@jay-johnson
jay-johnson / .vimrc
Last active November 11, 2016 14:23
vimrc paste toggling
set pastetoggle=<F10> " push F10 before pasting in insert mode to convert tabs and F10 after done pasting"
set autoindent " always set autoindenting on"
set smartindent " use smart indent if there is no indent file"
set tabstop=4 " <tab> inserts 4 spaces"
set softtabstop=4 " <BS> over an autoindent deletes 4 spaces."
set smarttab " Handle tabs more intelligently"
set expandtab " Use spaces, not tabs, for autoindent/tab key."
set shiftwidth=4 " an indent level is 4 spaces wide."
set shiftround " rounds indent to a multiple of shiftwidth"
set showmode
@jay-johnson
jay-johnson / common-logger.sh
Last active February 6, 2018 14:16
Colorize bash stdout with log appending
# include these methods and colors from another bash file with: source common-logger.sh .
# the parent bash script can override this log variable as needed this is a just a placeholder
log="/tmp/some-common.log"
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
blddkg=${txtbld}$(tput setaf 0) # Dark Gray
bldred=${txtbld}$(tput setaf 1) # Red
bldblu=${txtbld}$(tput setaf 2) # Blue
[root@ip-10-0-1-144 ~]# cp /usr/share/zoneinfo/EST /etc/localtime
[root@ip-10-0-1-144 ~]# date
Mon Aug 22 11:09:18 EST 2016
[root@ip-10-0-1-144 ~]# cp /usr/share/zoneinfo/EST5EDT /etc/localtime
[root@ip-10-0-1-144 ~]# date
Mon Aug 22 12:09:25 EDT 2016
[root@ip-10-0-1-144 ~]# service crond restart
Stopping crond: [ OK ]
Starting crond: [ OK ]
[root@ip-10-0-1-144 ~]# service rsyslog restart
@jay-johnson
jay-johnson / Fedora 22 docker systemd docker.service file
Created August 21, 2016 03:35
Backup Fedora 22 - docker systemd service file for running port + socket + overlay storage driver: /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
@jay-johnson
jay-johnson / How to Verify an SSL Certificate on a website.md
Last active July 29, 2016 02:46
How to Verify an SSL Certificate on a website
$ openssl s_client -connect jaypjohnson.com:443 -tls1
CONNECTED(00000003)
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = jaypjohnson.com
verify return:1
---
@jay-johnson
jay-johnson / Restart Docker Engine
Created July 15, 2016 06:18
Restart Docker Engine
sudo service docker restart
@jay-johnson
jay-johnson / Re-enable Docker Engine to use the Socket with System D
Created July 15, 2016 06:17
Re-enable Docker Engine to use the Socket with System D
ExecStart=/usr/bin/docker daemon -H 0.0.0.0:4000 -H unix:///var/run/docker.sock
@jay-johnson
jay-johnson / Build the CJE Docker Enterprise Container
Created July 15, 2016 06:16
Build the CJE Docker Enterprise Container
$ docker build -t jenkins-enterprise .
@jay-johnson
jay-johnson / Set the Docker Socket Permissions
Created July 15, 2016 06:16
Set the Docker Socket Permissions
$ sudo chmod 777 /var/run/docker.sock