Skip to content

Instantly share code, notes, and snippets.

View Jaykul's full-sized avatar
😀
Learning

Joel Bennett Jaykul

😀
Learning
View GitHub Profile
@Jaykul
Jaykul / testPalindrome
Created August 2, 2012 01:24
Test-Palindrome
def testPalindrome(p):
p = str(p)
return not any([True for i in range(0,len(p)/2) if p[i] <> p[-i-1]])
@Jaykul
Jaykul / Response.xml
Created January 8, 2014 20:54
The problem with ...
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http://bd-xd7-01/Citrix/Monitor/OData/v1/Data/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>http://bd-xd7-01/Citrix/Monitor/OData/v1/Data/Sessions</id>
<title type="text">Sessions</title>
<updated>2014-01-08T20:19:50Z</updated>
<link rel="self" title="Sessions" href="Sessions" />
<entry>
<id>http://bd-xd7-01/Citrix/Monitor/OData/v1/Data/Sessions(guid'5a84b30a-9190-4013-b458-81d64633c996')</id>
<category term="Citrix.Monitor.Repository.Session" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" title="Session" href="Sessions(guid'5a84b30a-9190-4013-b458-81d64633c996')" />
@Jaykul
Jaykul / Ribbon.psd1
Created January 30, 2014 08:20
Ribbon Window in PowerShell (#requires ShowUI)
## AutoGenerated file. Do Not Edit. Regenerate by running
## Add-UIModule -AssemblyName System.Windows.Controls.Ribbon -Name Ribbon
@{
ModuleVersion = '1.0'
RequiredModules = 'ShowUI'
RequiredAssemblies = 'System.Xaml','System.Windows.Controls.Ribbon'
ModuleToProcess = 'Ribbon.psm1'
GUID = 'b307ebad-cfb1-4c34-895c-471792c513db'
FunctionsToExport = @('New-KeyTipControl','New-RibbonContextualTabGroupsPanel','New-RibbonGalleryCategoriesPanel','New-RibbonGalleryItemsPanel','New-RibbonGroupItemsPanel','New-RibbonGroupsPanel','New-RibbonMenuItemsPanel','New-RibbonQuickAccessToolBarOverflowPanel','New-RibbonQuickAccessToolBarPanel','New-RibbonTabHeadersPanel','New-RibbonTabsPanel','New-RibbonTitlePanel','New-StarLayoutInfo','New-Ribbon','New-RibbonMenuButton','New-RibbonApplicationMenu','New-RibbonMenuItem','New-RibbonApplicationMenuItem','New-RibbonSplitMenuItem','New-RibbonApplicationSplitMenuItem','New-RibbonButton','New-RibbonCheckBox','New-RibbonComboBox','New-RibbonContextMenu','New-Ri
@Jaykul
Jaykul / appserver\static\autodiscover.js
Created November 13, 2014 03:38
Simple Simple Tricks
require.config({
paths: {
"app": "../app"
}
});
require(['splunkjs/mvc/simplexml/ready!'], function(){
require(['splunkjs/ready!'], function(){
// The splunkjs/ready loader script will automatically instantiate all elements
// declared in the dashboard's HTML.
@Jaykul
Jaykul / Search Updates.ps1
Created November 15, 2014 00:34
Remote Windows Updates
param(
[string[]]$ComputerName = ".",
[Parameter(Mandatory)]
[Management.Automation.Credential()]
[PSCredential]$Credential
)
$sessions = New-PSSession -ComputerName:$ComputerName -Credential:$Credential
@Jaykul
Jaykul / Test-Debug.ps1
Created November 30, 2014 01:48
The cost of Write-Debug when you're not debugging
function Test-DebugPreference {
[CmdletBinding()]
param($count = 1e5)
$Counter = 0
for($i = 0; $i -lt $count; $i++) {
if($DebugPreference -gt "SilentlyContinue") {
$Counter += 1
Write-Debug "The Counter is $Counter"
}
@Jaykul
Jaykul / Reflection.psm1
Last active March 12, 2018 23:32
Get-ParseResults
function Get-ParseResults {
param(
# The script or file path to parse
[Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
[Alias("Path","PSPath")]
$Script
)
$ParseErrors = $null
$Tokens = $null
@Jaykul
Jaykul / Generator.psm1
Last active March 12, 2018 23:34
Types And Inheritance
Import-Module poke -Force
$xlr8r = [psobject].assembly.gettype("System.Management.Automation.TypeAccelerators")
# ScriptBlock Parsing using a Parser Instance so we can pass it to the DefineTypeHelper later
function New-Type {
param(
[ScriptBlock]$TypeDefinition,
@Jaykul
Jaykul / NancyFx.ps1
Created March 10, 2015 20:59
Playing with classes in PowerShell 5 (February Preview)
# In the real world, I'm trying to use Nancy.NancyModule, but for demo's sake, it can be this simple:
add-type @'
namespace Nancy
{
public abstract class NancyModule
{
protected NancyModule() { }
}
}
'@
@Jaykul
Jaykul / fileinfo.ps1
Created March 18, 2015 21:10
PIpelineExample
function filesystem {
param(
[Parameter(ParameterSetName="Dirs",ValueFromPipeline)]
[System.IO.DirectoryInfo]$Directory,
[Parameter(ParameterSetName="Files",ValueFromPipeline)]
[System.IO.FileInfo]$File
)
process {
switch ($PSCmdlet.ParameterSetName) {