Instantly share code, notes, and snippets.

View Disconnected OSEv3 Install
VMs:
- ose3-disconnected-installer
- 1 GB RAM
- 2 vCPU
- 15 GB HD, default partitioning
- "private" virtual network (internal and host only routing)
- static IP
- RHEL 7.1 minimal server
- ose3-disconnected-master
- 8 GB RAM
View grip_style.css
code {
white-space: pre-wrap !important;
/* text-indent: -20px; */
/* padding-left: 30px; */
}
.markdown-body {
width: 100% !important;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am nsabine on github.
  • I am nicksabine (https://keybase.io/nicksabine) on keybase.
  • I have a public key whose fingerprint is 0731 859F B8E8 C479 964C 4CE3 9BBB BFFE 5A5B 69AF

To claim this, I am signing this object:

View add_user.sh
#!/bin/bash
#
# add_user.sh: Add user to LDAP
# Author: Nick Sabine
#
# Defaults
LDAP_BASE="dc=ORG,dc=local"
LDAP_ACCOUNTS_DN="ou=people,${LDAP_BASE}"
LDAP_USER_GROUP="cn=user_group,ou=groups,${LDAP_BASE}"
View created_spanned_drive.sh
#!/bin/bash
declare -a DISKS=($(fdisk -l | grep 'dev' | awk '{if ($3 > 1000) print $2}' | sed s/.$//))
declare -a INUSE=($(mount | awk '{if ($1 ~ '/dev/') print $1}'))
declare -a UNUSED=(`comm -23 <(echo ${DISKS[@]} | sed 's/ /\n/g' | sort -u) <(echo ${INUSE[@]} | sed 's/ /\n/g'| sort -u)`)
echo "All Disks larger than 1000 GB:"
for i in ${!DISKS[@]}
do
echo "$i=${DISKS[$i]}"
View create_spanned_drive.ps1
$disks = (wmic diskdrive list brief | measure-object -line | select -ExpandProperty Lines)-2
1..$disks | ForEach-Object -Begin {$a = $null} -Process { $a += $("select disk "+$_+[char][int](13)+[char][int](10)) ; $a += "online disk noerr "+[char][int](13)+[char][int](10) ; $a += "clean "+[char][int](13)+[char][int](10) ; $a += "attributes disk clear readonly noerr "+[char][int](13)+[char][int](10) ; $a += "convert dynamic noerr "+[char][int](13)+[char][int](10) ;} -End { $a += "exit"+[char][int](13)+[char][int](10) ; $a | Set-Content c:\diskpart1.txt -Encoding ASCII }
$a = "create volume stripe disk=1"
2..$disks | ForEach-Object -Process {$a += ","+$_}
$a += [char][int](13)+[char][int](10)
$a += "format fs=ntfs label=scratch quick"+[char][int](13)+[char][int](10)
$a += "assign letter=z"+[char][int](13)+[char][int](10)
$a += "exit"+[char][int](13)+[char][int](10)
View todos.py
import os
import keyword
import sys
# key phrase to look for
needle = 'todo'
# file extensions to be searched for todo statements
extensions_to_include = ('.py', '.c', '.m', '.h', '.txt')
View simple_database.py
import sqlite3
db_filename = "test.db"
def create_schema(conn):
schema = """
drop table if exists word;
create table word (
id integer primary key autoincrement not null,
w text
View random_generator.py
import random
def random_int(num: int = 1, min: int = 1, max: int = 100) -> [int]:
"""Return a list of random integers."""
ints = []
for i in xrange(num):
ints.append(random.randint(min,max))
return ints
def random_word(num: int = 1) -> [str]:
View duplicate_uids.py
#!/usr/bin/env python
from collections import defaultdict
# Initialize dictionary of user ids
uids = defaultdict(list)
# loop through password file, building dictionary of uid:[list of usernames]
with open("/etc/passwd") as passwd_file:
for line in passwd_file: