Skip to content

Instantly share code, notes, and snippets.

@oldarmyc
oldarmyc / s3.py
Created Dec 10, 2018
S3 example connection
View s3.py
"""
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 Dec 10, 2018
MySQL example connection
View mysql.py
"""
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 Dec 10, 2018
Neo4j example connection
View neo4j.py
"""
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 Dec 10, 2018
MariaDB example connection
View mariadb.py
"""
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 Dec 10, 2018
Oracle example connection
View oracle.py
"""
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 Dec 10, 2018
PostgreSQL example connection
View postgresql.py
"""
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 Dec 10, 2018
Mongo connection example
View mongo.py
"""
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 Dec 10, 2018
Snowflake example connection
View snowflake.py
"""
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 Dec 10, 2018
MSSQL example connector
View example.py
"""
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 Nov 28, 2018
Move/replace /var/lib/gravity
View move_gravity.md

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