Skip to content

Instantly share code, notes, and snippets.

View kenaniah's full-sized avatar

Kenaniah Cerny kenaniah

  • Rancho Palos Verdes, CA
  • 17:33 (UTC -07:00)
View GitHub Profile
@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
fswatch -r . --exclude "/target/" -o | xargs -n1 -I{} cargo test
<#
.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.
@kenaniah
kenaniah / ADManageShadowGroups.ps1
Last active March 3, 2020 21:09
Automatically manages "shadow groups" in Active Directory based on OUs.
<#
.SYNOPSIS
Manages Shadow Groups in Active Directory
.DESCRIPTION
This script automatically manages the member users of groups placed in
"OU=Shadow Groups,DC=mydomain,DC=local". 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.
@kenaniah
kenaniah / post-fetch.sh
Last active August 14, 2018 08:44
Git post-receive (remote push) and post-fetch (local pull) hooks for trac. Since post-fetch is not a real hook, it must be called manually after every fetch.
#!/bin/bash
# This isn't really a git hook, but it's manually called it after every fetch run.
# This script essentially wraps the actual post-receive hook.
# Build the standard input for the post-receive hook
cat refs/heads/* | paste TRAC_HEAD - > post-fetch.tmp
find refs/heads/* | paste post-fetch.tmp - | awk '{print $1, $2, $3}' > post-fetch.stdin
# Call the post-receive hook just like the commits were pushed
@kenaniah
kenaniah / word_finder.rb
Last active August 5, 2017 23:28
Capitals Word Finder
#!/usr/bin/env ruby
require 'colorize'
require 'sequel'
DB = Sequel.connect "postgres:///ospd"
# Helper method
class String
def counts
@kenaniah
kenaniah / versioning.rb
Created June 15, 2017 23:47
Versioning
module Versioned
module V0
def method_missing name
puts "#{name} not found".red
end
end
module V1
def foo
puts "foo 1"
@kenaniah
kenaniah / sequel_cti_isssue.rb
Created April 20, 2017 20:08
Sequel CTI Association Filtering Issue
class Related < Sequel::Model; end
class Parent < Sequel::Model
plugin(
:class_table_inheritance,
key: :type,
table_map: {
:Child => :children
}
)
@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 / react-template.jsx
Last active January 5, 2016 01:19
React Template
const reactComponent = React.createClass({
mixins: [],
propTypes: {},
// Initial defaults
//getDefaultProps: function(){},
//getInitialState: function(){},
// Property change lifecycle