Skip to content

Instantly share code, notes, and snippets.

View aytch's full-sized avatar

Brandon Presley aytch

  • Portland, OR, United States
View GitHub Profile
@aytch
aytch / gist:5069930
Created March 2, 2013 06:30
Photography and OOP: Understanding OOP
class Picture
def exposure(light_level, depth_of_field, motion_capture)
def light_level()
if light_level == "daylight"
iso=200
elsif light_level == "night"
iso = 1600
else
@aytch
aytch / gist:5114075
Created March 8, 2013 03:46
Vagrantfile for a basic multiple VM setup.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "base"
config.vm.box = "http://files.vagrantup.com/lucid32.box"
config.vm.define :server do |server_config|
server_config.vm.box = "base"
@aytch
aytch / gist:5230363
Created March 24, 2013 03:27
Basic Script for Office365 performance
#script to log into the BPOS environment
$LiveCred = Get-Credential
#Create a connection to the cloud-based organization using the following command.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
#Load the Exchange cmdlets on the local computer using the following commands:
$serverlist = "server1","server2"
foreach ($s in $serverlist) {
Invoke-Command -ComputerName $s -AsJob -ScriptBlock { chef-client --once }
}
function Expand-ZIPFile($file, $destination) {
$shell = new-object -com shell.application
$zip = $shell.NameSpace($file)
foreach ($item in $zip.items()) {
$shell.Namespace($destination).copyhere($item)
}
}
cd ~/Documents
mkdir WindowsPowershell\modules\PSReadLine
$domain = "ADATUM.com"
$username = "$domain\myUserAccount"
$password = "myPassword!" | ConvertTo-SecureString -asPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$DomainJoinArgs = @{
'DomainName' = $domain;
'Credential' = $credential;
'OuPath' = "";
'Server' = "[servername here]";
if ARGV == []
puts "Error: File path required"
exit(101)
end
ARGV.each do |file|
if File.exists?(file) == false
puts "Error: File does not exist"
exit(102)
end
@aytch
aytch / rain_world_pearls.md
Last active April 26, 2017 00:43
Rain World Lore

Five Pebbles

...

...is this reaching you?

A little animal, on the floor of my chamber. I think I know what you are looking for.

You're stuck in a cycle, a repeating pattern. You want a way out.

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
function Set-ElevatedStatus {
# If you launched Powershell normally, this will relaunch Powershell as an Admin
$WindowsPrincipal = new-object System.Security.Principal.WindowsPrincipal(`
[System.Security.Principal.WindowsIdentity]::GetCurrent() )
$IsAdmin = $WindowsPrincipal.IsInRole(`
[System.Security.Principal.WindowsBuiltInRole]::Administrator)
if ($IsAdmin -eq $True) {
# No action required
}
else {