Skip to content

Instantly share code, notes, and snippets.

Rob Layton roblayton

Block or report user

Report or block roblayton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@roblayton
roblayton / example.service
Created Jul 6, 2015
An example systemd service
View example.service
[Unit]
Description="My Service"
[Service]
ExecStart=/usr/bin/printf "Service trigger"
[Install]
WantedBy=multi-user.target
@roblayton
roblayton / hashgen.py
Created Jun 29, 2015
Generates a hashed password
View hashgen.py
# import the hash algorithm
from passlib.hash import sha256_crypt
# generate new salt, hash a password string
hash = sha256_crypt.encrypt("password")
print(hash)
@roblayton
roblayton / Vagrantfile
Last active Aug 29, 2015
A Vagrant multi-machine cluster
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: "apt-get update"
@roblayton
roblayton / Vagrantfile
Created Jun 14, 2015
A Vagrantfile for a MongoDB Replica Set
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define :primary do |primary|
@roblayton
roblayton / Vagrantfile
Last active Aug 29, 2015
A Vagrantfile for a MongoDB cluster
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define :configsvr1 do |configsvr1|
@roblayton
roblayton / Vagrantfile
Last active Aug 29, 2015
A Vagrantfile to spin up 2 mysql instances for a master-master configuration
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: "apt-get update"
@roblayton
roblayton / haproxy.cfg
Last active Aug 29, 2015
HAProxy config file for a MySQL cluster
View haproxy.cfg
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxy
defaults
log global
mode http
retries 3
@roblayton
roblayton / namewriter.py
Created Jun 6, 2015
Python server for writing names to a MySQL DB
View namewriter.py
import MySQLdb
import argparse
db = MySQLdb.connect(host="192.168.33.10", user="test", passwd="password", db="test")
cursor = db.cursor()
parser = argparse.ArgumentParser(description="Process some strings.")
parser.add_argument("firstname", type=str, help="firstname")
parser.add_argument("lastname", type=str, help="lastname")
args = parser.parse_args()
@roblayton
roblayton / namereader.py
Created Jun 6, 2015
A Python server for reading names from a MySQL DB
View namereader.py
import MySQLdb
db = MySQLdb.connect(host="192.168.33.10", user="test", passwd="password", db="test")
cursor = db.cursor()
cursor.execute("SELECT firstname,lastname FROM test.name")
for row in cursor.fetchall():
firstname = str(row[0])
lastname = str(row[1])
@roblayton
roblayton / Vagrantfile
Last active Aug 29, 2015
Basic Vagrantfile
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
end
You can’t perform that action at this time.