Skip to content

Instantly share code, notes, and snippets.

@oldarmyc
oldarmyc / s3.py
Created December 10, 2018 18:30
S3 example connection
"""
The s3fs package would need to be installed using conda install
conda install -c anaconda s3fs
"""
from s3fs.core import S3FileSystem
import configparser
@oldarmyc
oldarmyc / mysql.py
Created December 10, 2018 18:28
MySQL example connection
"""
To connect to mysql you would need to conda install the mysql-connector-python conda package
conda install -c anaconda mysql-connector-python
"""
import mysql.connector as mysql
import json
# Get credentials from kubernetes. The credentials were setup as a dictionary
@oldarmyc
oldarmyc / neo4j.py
Created December 10, 2018 18:25
Neo4j example connection
"""
To start working with Neo4j you would need to pip install the package.
pip install neo4j
Documentation is located here:
https://neo4j.com/docs/api/python-driver/current/
"""
from neo4j import GraphDatabase
@oldarmyc
oldarmyc / mariadb.py
Created December 10, 2018 18:23
MariaDB example connection
"""
To connect to mariadb you would need to conda install the mysql-connector-python package
conda install -c anaconda mysql-connector-python
"""
import mysql.connector as mariadb
import json
# Read the credentials from secret
@oldarmyc
oldarmyc / oracle.py
Created December 10, 2018 18:21
Oracle example connection
"""
In order to connect to oracle the following packages will need to be installed from conda.
cx_oracle
oracle-instantclient
libaio
"""
# Import the library needed
import cx_Oracle
@oldarmyc
oldarmyc / postgresql.py
Created December 10, 2018 18:19
PostgreSQL example connection
"""
Package psycopg2 must be installed through conda for this to work
conda install -c anaconda psycopg2
"""
import psycopg2
import json
# Get credentials from kubernetes. The credentials were setup as a dictionary
@oldarmyc
oldarmyc / mongo.py
Created December 10, 2018 18:16
Mongo connection example
"""
pymongo will need to be installed from conda for things to work properly
conda install -c anaconda pymongo
"""
import pymongo
import json
"""
Connect to the mongo server. In the example it is using the default auth mechanism
@oldarmyc
oldarmyc / snowflake.py
Created December 10, 2018 18:13
Snowflake example connection
"""
Installing the connector it is recommended to use pip and not the conda-forge package
pip install snowflake-connector-python
"""
import snowflake.connector
import json
# Get credentials from kubernetes. The credentials were setup as a dictionary so will use json to load
@oldarmyc
oldarmyc / example.py
Created December 10, 2018 18:10
MSSQL example connector
"""
In order to use the example you must install pymssql from conda
conda install -c anaconda pymssql
"""
import pymssql
# Using an ini style credentials file for example so will use configparser
import configparser
@oldarmyc
oldarmyc / move_gravity.md
Created November 28, 2018 18:21
Move/replace /var/lib/gravity

Changing out /var/lib/gravity

In the example below /dev/sdb was presented to the VM. You would use whatever disk was presented in your setup.

  1. Get the disks presented to the system
fdisk -l
  1. Create the partition on the disk. Using fdisk but you can use others i.e. gdisk