Skip to content

Instantly share code, notes, and snippets.

View dfch's full-sized avatar

Ronald Rink dfch

View GitHub Profile
@dfch
dfch / HttpClient.cs
Last active November 26, 2023 16:59
HttpClient and how to use Headers, Content-Type and PostAsync
// HttpClient and how to use Headers, Content-Type and PostAsync
// http://d-fens.ch/2014/04/12/httpclient-and-how-to-use-headers-content-type-and-postasync/
// Copyright 2014-2015 Ronald Rink, d-fens GmbH
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
@dfch
dfch / ### Miscellaneous Scripts.md
Last active August 29, 2015 14:09
LightSwitch: Modifying roles, permissions and users via PowerShell

Miscellaneous Scripts

d-fens GmbH General-Guisan-Strasse 6 CH-6300 Zug Switzerland

@dfch
dfch / Convert-Currency.ps1
Created November 4, 2014 07:26
[NoBrainer] PowerShell Currency Converter
# http://d-fens.ch/2014/01/07/nobrainer-powershell-currency-converter/
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string] $From
,
[Parameter(Mandatory = $true, Position = 1)]
[string] $To
,
[Parameter(Mandatory = $false, Position = 2)]
@dfch
dfch / Set-DomainMembership.ps1
Created November 4, 2014 07:11
vCAC: Dynamically execute Scripts in ExternalWFStubs Workflows with PowerShell - Set-DomainMembership.ps1
# http://d-fens.ch/2013/12/05/vcac-dynamically-execute-scripts-in-externalwfstubs-workflows-with-powershell/
PARAM (
[ValidateSet('EXAMPLE', 'SHAREDOP')]
[Parameter(Mandatory = $true, Position = 0)]
[string] $Domain
,
[Parameter(Mandatory = $true, Position = 1)]
[string] $Username
,
@dfch
dfch / ExternalWFStubs-Part2.ps1
Created November 4, 2014 06:50
vCAC: Dynamically execute Scripts in ExternalWFStubs Workflows with PowerShell (2)
# http://d-fens.ch/2013/12/05/vcac-dynamically-execute-scripts-in-externalwfstubs-workflows-with-powershell/
# Machine is the currently processed virtual machine
# Path is a default path where the scripts are located
# ScriptName is the name of the PowerShell script passed from the custom properties
# htScriptParam is a hastable containing parameter name and raw expression
$ScriptName = Join-Path -Path $Path -ChildPath $ScriptName;
if( !(Test-Path -Path $ScriptName) ) {
Write-Error ("ScriptName '{0}' does not exist." -f $ScriptName);
@dfch
dfch / ExternalWFStubs-Part1.ps1
Last active August 29, 2015 14:08
vCAC: Dynamically execute Scripts in ExternalWFStubs Workflows with PowerShell (1)
# http://d-fens.ch/2013/12/05/vcac-dynamically-execute-scripts-in-externalwfstubs-workflows-with-powershell/
PS > $Machine.GetType().FullName
DynamicOps.ManagementModel.VirtualMachine
PS > $m.GetType().FullName
DynamicOps.ManagementModel.ManagementModelEntities
# script main
$Write-Host ("{0}: Processing Machine entity: '{1}'." -f $Machine.VirtualMachineID, $Machine.VirtualMachineName);
@dfch
dfch / Invoke-SqlCmd.ps1
Created October 19, 2014 18:38
[biz.dfch.PS.System.Data] Invoke-SqlCmd without the overhead
# [biz.dfch.PS.System.Data] Invoke-SqlCmd without the overhead
# http://d-fens.ch/2013/11/26/biz-dfch-ps-system-data-invoke-sqlcmd-without-the-overhead
function Invoke-SqlCmd {
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="Medium",
HelpURI='http://dfch.biz/PS/System/Data/Invoke-SqlCmd/'
)]
Param (
@dfch
dfch / Invoke-CteraFileTransfer.ps1
Last active August 29, 2015 14:06
biz.dfch.PS.Storebox.Api: Invoke-CteraFileTransfer
// http://d-fens.ch/2013/11/27/biz-dfch-ps-storebox-api-invoke-cterafiletransfer/
// Check https://github.com/dfch/biz.dfch.PS.Storebox.Api for the complete repository of this module
function Invoke-CteraFileTransfer {
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High",
HelpURI='http://dfch.biz/PS/Storebox/Api/Invoke-CteraFileTransfer'
)]
[OutputType([string])]
Param (
@dfch
dfch / AddFuncensteinScreen.lsml.js
Last active August 29, 2015 14:06
[NoBrainer] Changing LightSwitch HTML Cascading choiceLists with JayData
// global - or wherever it suits you
var ctxApplicationData = "ctxApplicationData";
// somewhere at the very start of the application
$(function () {
var svcApplicationData = msls.application.rootUri + "/ApplicationData.svc";
$data.initService(svcApplicationData)
.then(function (context) {
// manage your data through context with JSLQ
console.log(svcApplicationData + ": we are here...");
@dfch
dfch / rabbitmq-wrapper.cs
Last active August 29, 2015 14:06
Simple RabbitMQ Wrapper for PowerShell
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using RabbitMQ.Util;