Skip to content

Instantly share code, notes, and snippets.

@shaunhess
shaunhess / Generating a system list from Active Directory
Created October 20, 2013 19:27
Generating a system list from Active Directory
Having a large number of workstations or servers within an enterprise brings a host of challenges in trying to maintain them. We are constantly having to reach out and perform an action on a set of boxes. Relying on your own or someone else's outdated system list is not an option. A quick and easy fix is to go straight to the source. Dsquery is a command-line too that allows us to query Active Directory based on criteria we feed into it. Today we are going to focus on one common criteria used, dsquery computer, which finds computers in the directory that matches our search patterns. Here's the syntax:
dsquery computer [{<StartNode> | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name <Name>] [-desc <Description>] [-samid <SAMName>] [-inactive <NumberOfWeeks>] [-stalepwd <NumberOfDays>] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [-r] [-gc] [-limit <NumberOfObjects>] [{-uc | -uco | -uci}]
So to pull a list of workstations fr
@shaunhess
shaunhess / Go-QRG.md
Last active February 11, 2022 03:07
Go - Quick Reference Guide

golang - Quick Reference Guide

Advantages of Go

  1. Garbage Collection - Automatic memory management
  2. Fast to compile and execute
  3. Simpler Langauge
  4. Concurrency is efficient

Get started by downloading Go @ https://golang.org/dl/

################################################################################
# Making custom named pipes
################################################################################
Open two ssh sessions to a system. In one, create your pipe and then send some command output to it.
$ mkfifo mypipe
$ cal > mypipe
Don’t worry that your command just seems to hang.
In the other, read from the pipe.
@shaunhess
shaunhess / monitor_notes
Created April 1, 2014 01:26
Monitor Notes
################################################################################
# Calculate Pixels Per Inch
################################################################################
# Calculate w/ the Horizontal x Vertical resolution, Horizontal & Vertical size
################################################################################
Horizontal_Resolution = 2560
Vertical_Resolution = 1440
Horizontal_Size_MM = 597.89
Vertical_Size_MM = 336.31
@shaunhess
shaunhess / cache_perf_calc
Created April 19, 2015 19:18
Cache Performance Calculation
Cache is a net benefit in perf if time saved in cache hits exceeds time lost in cache overhead.
L = Regular lookup
H = Cache Hit
M = Cache Miss
R = Cache Hit Ratio (500 lookups/100 served from cache is 20%)
H x R + M x (1 - R) < L
@shaunhess
shaunhess / Scheme_Notes
Created July 18, 2015 22:30
Notes from SICP using Scheme (LISP)
;; Installation on Mac OS X
;; After downloading and installing into applications folder run the following commands from the terminal
;; sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-x86-64
;; sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/bin/scheme
;; To Launch simply type "scheme" in the terminal
;; Using operators on operands (Scheme uses prefix notation)
(+ 4 4) ; Add 4 + 4 = 8
;; Add two numbers that are multiplied
@shaunhess
shaunhess / Memory_Intro
Last active August 29, 2015 14:27
A Brief Introduction to Memory
RAM, random access memory, is the ability to store/read values based on address inputs
(versus say sequentially). It is also commonly referred to as voltile memory because it
requires a constant supply of electricity to retain its contents.
The number of values that a RAM array can store is based on the number of address inputs.
With 1 address input we can store 2 values (0 or 1).
2 addresses = 4 values (00, 01, 10, 11)
3 addresses = 8 values (000, 001, 010, 100, 011, 101, 110, 111)
4 addresses = 16 values
@shaunhess
shaunhess / code_complexity_efficiency.py
Last active September 30, 2015 23:51
Measuring Code Complexity and Efficiency
# Measure complexity as a function of input size
# - Worst case scenario
# - Largest factor in expression
# Asymptotic Notation - provide a formal way to talk about the relationship between
# the running time of an algorithm and the size of inputs.
#
# Asymptotic notation describes the complexity of an algorithm as the size of it's
# inputs approaches infinity
@shaunhess
shaunhess / Vagrant_Setup_Win10_x64.txt
Last active March 10, 2016 19:04
Vagrant Setup on Windows 10 64bit
1) Download and install Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package
https://www.microsoft.com/en-us/download/details.aspx?id=26999
2) Download and install VirtualBox
https://www.virtualbox.org/
3) Download and install Vagrant
https://www.vagrantup.com/
4) Download and replace curl.exe in C:\HashiCorp\Vagrant\embedded\bin
@shaunhess
shaunhess / CentOS7_min_desktop_setup.txt
Created March 10, 2016 17:21
CentOS7 Minimal Desktop Installation
1. Install CentOS 7 - Minimal
2. yum groupinstall "X Window System"
3. yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
4. unlink /etc/systemd/system/default.target
5. ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
6. reboot