Skip to content

Instantly share code, notes, and snippets.

View kenaniah's full-sized avatar

Kenaniah Cerny kenaniah

  • Rancho Palos Verdes, CA
  • 00:21 (UTC -08:00)
View GitHub Profile
@kenaniah
kenaniah / structure.sql
Last active February 22, 2017 22:59
PostgreSQL Auditing Schema
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
@kenaniah
kenaniah / git-auto-clone.sh
Last active January 21, 2022 17:19
Git Branch auto-clone script
# Git branch auto-clone script
# https://gist.github.com/kenaniah/7af6efe09df138a8a2b9
# BASE should point to a bare git repo
# DEST should point to a directory for branches to be checked out into
# Define where things are pulled from
BASE=$1
DEST=$2
# Fetch to the source repo
@kenaniah
kenaniah / reading_plan.js
Created March 31, 2015 21:17
Generates a daily reading list based on the number of chapters in books and total number of days
//Total number of days
var days = process.argv[2] || 90
//List of books
var books = {
Genesis: 50,
Exodus: 40,
Leviticus: 27,
Numbers: 36,
Deuteronomy: 34,
<#
.SYNOPSIS
Manages Shadow Groups in Active Directory
.DESCRIPTION
This script automatically manages the member users of groups placed in
"OU=Shadow Groups,DC=contoso,DC=com". Users and computers that are contained
by OUs that match the name of a shadow group are automatically added to that group,
and users that are no longer contained by a matching OU are removed from
the group.
$GROUPS = Get-ADGroup -Filter * -Properties proxyAddresses,mail,displayName
$GROUPS | ForEach {
$GROUP = $_
$GROUP.proxyAddresses = $null
if($GROUP.mail){
$MAIL = $GROUP.mail.ToString()
$NAME = $GROUP.name.ToString()
$GROUP.proxyAddresses = "SMTP:$MAIL"
$GROUP.displayName = $NAME
}
# Connect to Microsoft Online as admin
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "[email protected]",(Get-Content admin.pass | ConvertTo-SecureString)
Connect-MsolService -Credential $cred
# Connect to Office365 as admin
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic -AllowRedirection
Set-ExecutionPolicy unrestricted
Import-PSSession $session
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT
# Usage information
if [ $# -ne 2 ]
then
echo "Usage: $0 <original_name> <new_name>"
echo
#!/bin/bash
processors=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
# Usage information
if [ $# -ne 2 ]
then
echo "Usage: $0 <source_file> <dbname>"
echo
echo "This script will restore the requested database from the given source file."
@kenaniah
kenaniah / setup.sh
Created November 3, 2015 16:01
Laptop Onboarding
#!/bin/bash
echo 'alias ll="ls -l"' >> /etc/profile
echo 'alias morningbrew="brew update && brew upgrade --all && brew cleanup && brew prune && gem update"' >> /etc/profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Page</title>
</head>
<style>
HTML, BODY, MAIN {
width: 100%;
height: 100%;