Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@Iristyle
Iristyle / ConvertTo-Hashtable.ps1
Created May 30, 2013 12:04
Turn a PSCustomObject into a standard hash
function ConvertTo-Hashtable
{
<#
.Synopsis
Converts a PSCustomObject that may be returned over WinRM to a
standard Hashtable
.Description
.Parameter PSObject
.Example
#>
# TODO: replace this hard-coded path with the path on disk where dngs are stored for current trip
$tripLocalPath = 'C:\Users\Ethan\Pictures\Curacao 2013'
$tripLocalFilter = '*.dng'
$memoryCardPath = 'd:\\'
$memoryCardFilter = '*.orf'
$names = dir $tripLocalPath -Recurse -Include $tripLocalFilter |
Select -ExpandProperty BaseName |
Sort-Object
@Iristyle
Iristyle / current_scope.py
Created July 16, 2013 15:52
Sublime scope under current cursor
print(view.syntax_name(view.sel()[0].begin()))
@Iristyle
Iristyle / fizzbuzz.exs
Created July 24, 2013 18:26
Elixir FizzBuzz
defmodule FizzBuzz do
def sequence([]), do: []
def sequence(until) when is_integer(until) and until > 0 do
sequence(0..until |> Enum.to_list)
end
def sequence([head|tail]) do
output(rem(head, 3), rem(head, 5), head)
sequence(tail)
end
@Iristyle
Iristyle / janky-pr-check.sh
Created July 26, 2013 19:49
For use during a PR sent to Janky to ensure latest code is pulled
if [[ ! -d './.git' ]]; then
git init
fi
owner=$(echo $JANKY_COMMIT_URL | sed -rn 's/^http(s)?\:\/\/github\.com\/(.*?)\/(.*?)\/?/\2/p')
repo=$(echo $JANKY_COMMIT_URL | sed -rn 's/^http(s)?\:\/\/github\.com\/(.*?)\/(.*?)\/?/\3/p')
url="https://[email protected]/$owner/$repo"
found=$(git remote | grep $owner)
@Iristyle
Iristyle / git-rewrite-file-paths.sh
Created August 28, 2013 00:28
Rewrite git tree to add prefix to file paths
## rewrite the tree to add a prefix and trash some unnecessary files
git filter-branch --index-filter 'rm -f "$GIT_INDEX_FILE" && git read-tree --prefix=acceptance/ "$GIT_COMMIT" && git rm acceptance/.gitignore acceptance/Gemfile --ignore-unmatch' HEAD
@Iristyle
Iristyle / output.txt
Last active December 22, 2015 07:39
bundle exec rake spec output
D:\Users\Parity\Documents\source\00 - Puppet\puppet [21133]> bundle install --path .bundle/gems
Fetching gem metadata from https://rubygems.org/......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake (10.1.0)
Installing activesupport (3.0.20)
Installing builder (2.1.2)
Installing i18n (0.5.0)
Installing activemodel (3.0.20)
Installing arel (2.0.10)
@Iristyle
Iristyle / Preferences.Sublime-settings
Created September 16, 2013 18:07
Preferences.Sublime-settings
{
"auto_complete_commit_on_tab": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Solarized Color Scheme/Solarized (dark).tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro Semibold",
"font_size": 15.0,
"highlight_line": true,
@Iristyle
Iristyle / KMBS Ripper
Last active December 24, 2015 16:39
Ripper - Konica Minolta Driver Scrubbing Utility
Looks like I originally wrote this hunk of junk 10+ years ago. Brings back some, ahem, fond .. memories.
Expects psexec.exe and reg.exe in the local directory
@Iristyle
Iristyle / json-polyfill.ps1
Created April 18, 2014 17:54
PS2 JSON Polyfill
function ConvertFrom-JsonString
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]
$Json
)
Add-Type -AssemblyName System.Web.Extensions