Skip to content

Instantly share code, notes, and snippets.

View ap0llo's full-sized avatar
💭
🚀

Andreas Grünwald ap0llo

💭
🚀
View GitHub Profile
@ap0llo
ap0llo / ModuleAssemblyLoader.cs
Last active February 3, 2018 16:54
Loads the assembly System.Net.Http.Primitives from the same location as the executing assembly in a powershell module. This is necessary when using the Google .NET client library in powershell Cmdlets
using System;
using System.IO;
using System.Management.Automation;
using System.Reflection;
/// <summary>
/// Powershell module intializer that ensures that the assembly System.Net.Http.Primitives required by Goolge client library is loaded correctly
/// </summary>
public class ModuleAssemblyLoader : IModuleAssemblyInitializer
{
@ap0llo
ap0llo / Visual Studio - Customized.xml
Last active August 29, 2015 14:24
Customized Visual Studio Keymap for IntelliJ
<keymap version="1" name="Visual Studio - Customized" parent="Visual Studio">
<action id="CollapseAll">
<keyboard-shortcut first-keystroke="control SUBTRACT" />
</action>
<action id="CollapseAllRegions">
<keyboard-shortcut first-keystroke="control M" second-keystroke="control O" />
</action>
<action id="CollapseBlock" />
<action id="CollapseRegion" />
<action id="CollapseSelection">
@ap0llo
ap0llo / .gitignore
Last active October 8, 2016 22:29
Duplicate Project Reference Example
obj/
bin/
@ap0llo
ap0llo / RelayCommand.cs
Created October 16, 2016 15:08
RelayCommand
using System;
using System.Windows.Input;
namespace Snippet
{
public class RelayCommand : ICommand
{
readonly Action<object> m_Execute;
readonly Func<object, bool> m_CanExecute;
@ap0llo
ap0llo / Export-VisioDrawing.ps1
Last active May 15, 2024 00:18
Powershell script that exports Visio drawings in the current directory to png
# Powershell script that exports visio drawings to png
# Based on a F# script with the same purpose which can be found at
# http://stackoverflow.com/questions/1145269/visio-to-image-command-line-conversion
$outputFormat = ".png"
$inputFilePattern = "*.vsdx"
# Load Visio Interop Assembly
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Visio") > $null
@ap0llo
ap0llo / Export-Presentation.ps1
Last active February 8, 2024 12:37
Powershell script to export Powerpoint Presentations to pdf using the Powerpoint COM API
# Powershell script to export Powerpoint Presentations to pdf using the Powerpoint COM API
# Based on a VB script with the same purpose
# http://superuser.com/questions/641471/how-can-i-automatically-convert-powerpoint-to-pdf
function Export-Presentation($inputFile)
{
# Load Powerpoint Interop Assembly
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Powerpoint") > $null
[Reflection.Assembly]::LoadWithPartialname("Office") > $null
# Powershell script to export tables from excel to LaTeX markup
function ConvertTo-Latex($inputFile, $sheetName, $startX, $startY, $endX, $endY, $outputFile)
{
function Get-LatexTableOptions($columnCount)
{
$options = "|"
for($i = 0; $i -lt $columnCount; $i = $i + 1)
@ap0llo
ap0llo / Export-Slide.ps1
Created January 11, 2017 20:25
# Powershell script to export Powerpoint slides as jpg images using the Powerpoint COM API
# Powershell script to export Powerpoint slides as jpg images using the Powerpoint COM API
function Export-Slide($inputFile, $slideNumber, $outputFile)
{
# Load Powerpoint Interop Assembly
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Powerpoint") > $null
[Reflection.Assembly]::LoadWithPartialname("Office") > $null
$msoFalse = [Microsoft.Office.Core.MsoTristate]::msoFalse
$msoTrue = [Microsoft.Office.Core.MsoTristate]::msoTrue
@ap0llo
ap0llo / Export-Chart.ps1
Created January 15, 2017 19:08
Powershell script to export charts from excel to jpg
# Powershell script to export charts from excel to jpg
function Export-Chart($inputFile, $sheetName, $chartIndex, $outputFile)
{
# Load Powerpoint Interop Assembly
[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Excel") > $null
[Reflection.Assembly]::LoadWithPartialname("Office") > $null
$msoFalse = [Microsoft.Office.Core.MsoTristate]::msoFalse
$msoTrue = [Microsoft.Office.Core.MsoTristate]::msoTrue
# https://gist.github.com/ap0llo/4e3b173afe6ca23299add223396de165
function Open-SolutionFile([string]$Name) {
if (($null -ne $Name) -and ($Name -ne "")) {
$slnFiles = Get-ChildItem -File *.sln -Recurse | Where-Object { $_.Name -like "*$Name*" }
} else {
$slnFiles = Get-ChildItem -File *.sln -Recurse
}