Skip to content

Instantly share code, notes, and snippets.

Nick Sabine nsabine

Block or report user

Report or block nsabine

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
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:

@nsabine
nsabine / add_user.sh
Created Sep 17, 2013
Shell script to add a user to LDAP. Based on OpenLDAP and RFC 2307 memberuid group attributes.
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]}"
@nsabine
nsabine / create_spanned_drive.ps1
Created Aug 7, 2013
Create a spanned volume in windows from AWS ephemeral disks.
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')
@nsabine
nsabine / simple_database.py
Created May 6, 2013
Read and write simple data to a sqlite database
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
@nsabine
nsabine / random_generator.py
Last active Dec 17, 2015
Generators for random integers or words
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]:
@nsabine
nsabine / duplicate_uids.py
Last active Dec 16, 2015
Find duplicate user ids on a system by parsing the /etc/passwd file
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:
You can’t perform that action at this time.