Skip to content

Instantly share code, notes, and snippets.

View yannduran's full-sized avatar

Yann Duran yannduran

View GitHub Profile
@yannduran
yannduran / free_ports.sh
Last active November 1, 2024 13:00 — forked from c01dfusion/free_ports.sh
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
@yannduran
yannduran / bootstrapwindows10.ps1
Created December 20, 2020 07:57 — forked from zloeber/bootstrapwindows10.ps1
Boxstarter Windows 10 Configuration
<#
The command to run, built from the raw link of this gist
Win+R
iexplore http://boxstarter.org/package/url?<RAW GIST LINK>
OR (if you don't like the way the web launcher force re-installs everything)
@yannduran
yannduran / scan-vs-dlls.linq
Created October 4, 2020 12:12 — forked from bert2/scan-vs-dlls.linq
Developing a VS extension and want to style it with the VS theme? This is a list of all `*style.xaml` files found in the VS dlls. Open any of the DLLs with ILSpy to inspect the XAML files (they're named `*.baml` after compilation).
// This needs to be executed multiple times, because it will crash with an out of memory exception.
// Once an assembly has been loaded with `Assembly.LoadFile()`, it cannot be unloaded again. The
// +10K DLLs to load will eat up all your memory, but the script will resume at the DLL that
// crashed the process, when it is restarted.
void Main() {
// Adjust those paths.
var resultStore = @"C:\Users\bert\Desktop\vs-style-baml-files.txt";
var lastFileStore = @"C:\Users\bert\Desktop\vs-baml-files.last.txt";
// Make sure this file exists (empty).
@yannduran
yannduran / MyPersonalDesktopBoxstarter.ps1
Last active December 23, 2020 12:18 — forked from jnm2/JosephPersonalDesktopBoxstarter.ps1
My personal desktop Boxstarter script
Disable-UAC
# TODO: unpin Edge and Store and pin default apps
# SilentlyContinue — Don't display an error message continue to execute subsequent commands.
# Continue — Display any error message and attempt to continue execution of subsequence commands.
# Inquire — Prompts the user whether to continue or terminate the action
# Stop — Terminate the action with error.
$ErrorActionPreference = 'Continue'
@yannduran
yannduran / devenv.pkgundef
Created July 4, 2019 12:20 — forked from madskristensen/devenv.pkgundef
Disable built-in Visual Studio packages
//********************************************************//
// HOW TO:
// Create a file called devenv.pkgundef in the same directory as devenv.exe.
// It's usually located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
// Then call "devenv.exe /updateconfiguration" from an elevated command prompt.
// REMARKS:
// Each GUID below represent a package that Visual Studio is loading. This is the
// list of package that I personally don't ever use. You can modify the list of
@yannduran
yannduran / KnownMonikersToBitmap.cs
Created July 4, 2019 12:16 — forked from madskristensen/KnownMonikersToBitmap.cs
Uses the IVsImageService2 to convert a KnownMoniker to BitmapSource
public static BitmapSource GetImage(ImageMoniker moniker, int size)
{
ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags;
imageAttributes.ImageType = (uint)_UIImageType.IT_Bitmap;
imageAttributes.Format = (uint)_UIDataFormat.DF_WPF;
imageAttributes.LogicalHeight = size;
imageAttributes.LogicalWidth = size;
imageAttributes.StructSize = Marshal.SizeOf(typeof(ImageAttributes));
Usage: VSIXInstaller.exe [/quiet] [/admin] [/skuName:name /skuVersion:version] </uninstall:vsixID | vsix_path>
- OPTIONS -
/quiet
Suppresses the UI. Short form is '/q'.
/admin
The extension will be installed to the admin extensions location. Short form is '/a'.
@yannduran
yannduran / VSIX UIContext
Created March 24, 2019 05:55 — forked from madskristensen/VSIX UIContext
Shows how to add custom UIContexts
On the package
[ProvideAutoLoad(UIContexts.LoadContext)]
[ProvideUIContextRule(UIContexts.LoadContext,
"RightFileTypeOpen",
"(CSharpFileOpen | VBFileOpen)",
new[] { "CSharpFileOpen", "VBFileOpen" },
new[] { "ActiveEditorContentType:CSharp", "ActiveEditorContentType:Basic" })]
In the VSCT
@yannduran
yannduran / VSTS_CreateReleasePullRequest.ps1
Created March 11, 2018 22:37 — forked from MarcusFelling/VSTS_CreateReleasePullRequest.ps1
Uses the VSTS REST API to create pull request
<#
.SYNOPSIS
Uses the VSTS REST API to create pull request
.DESCRIPTION
This script uses the VSTS REST API to create a Pull Request in the specified
repository, source and target branches. Intended to run via VSTS Build using a build step for each repository.
https://www.visualstudio.com/en-us/docs/integrate/api/git/pull-requests/pull-requests
.NOTES
@yannduran
yannduran / ImportMefComponent.cs
Created November 15, 2015 06:46 — forked from madskristensen/ImportMefComponent.cs
Import MEF components from non-MEF exported classes
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.TableManager;
public class ExtensionPackage : Package
{
[Import]
private ITableManagerProvider _tableManagerProvider;
protected override void Initialize()