Skip to content

Instantly share code, notes, and snippets.

View jankurianski's full-sized avatar

Jan Kurianski jankurianski

View GitHub Profile
@jankurianski
jankurianski / az-cli-list-cdn-custom-domains.sh
Created August 7, 2023 05:58
Azure: list all custom domains of all endpoints of all CDN profiles of all subscriptions
#!/usr/bin/bash
set -euo pipefail
# List all custom domains of all endpoints of all CDN profiles of all subscriptions
echo "CUSTOM_DOMAIN,ENDPOINT_NAME,CDN_NAME,RESOURCE_GROUP,SUBSCRIPTION"
SUBSCRIPTIONS=$(az account list --query "[].{id:id}" -o tsv)
echo "$SUBSCRIPTIONS" | while read -r SUBSCRIPTION
do
az account set --subscription $SUBSCRIPTION
@jankurianski
jankurianski / SendKeyEventExample.cs
Created December 4, 2017 04:13
Example of SendKeyEvent for CefSharp.OffScreen
[DllImport("user32.dll")]
public static extern int ToUnicode(uint virtualKeyCode, uint scanCode,
byte[] keyboardState,
[Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = 64)]
StringBuilder receivingBuffer,
int bufferSize, uint flags);
/// <summary>
/// https://stackoverflow.com/a/6949520/450141
diff --git a/CefSharp.WinForms.Example/BrowserTabUserControl.Designer.cs b/CefSharp.WinForms.Example/BrowserTabUserControl.Designer.cs
index b97bf79f..1f454947 100644
--- a/CefSharp.WinForms.Example/BrowserTabUserControl.Designer.cs
+++ b/CefSharp.WinForms.Example/BrowserTabUserControl.Designer.cs
@@ -1,4 +1,6 @@
-<U+FEFF>namespace CefSharp.WinForms.Example
+<U+FEFF>using System.Windows.Forms;
+
+namespace CefSharp.WinForms.Example
{
@jankurianski
jankurianski / gist:2163d7928d3d6f839e47
Last active June 12, 2023 15:32
Hack to close ToolStrip dropdown when ChromiumWebBrowser is focused
ChromeWidgetMessageInterceptor chromeWidgetMessageInterceptor;
private void OnIsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs args)
{
if (args.IsBrowserInitialized)
{
SetupChromeWidgetMessageInterceptor();
}
}
@jankurianski
jankurianski / Program.cs
Created December 9, 2014 04:40
Example of LoadHtml with CefSharp.OffScreen
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using CefSharp.Example;
@jankurianski
jankurianski / ControlSnapshot.cs
Created December 2, 2014 07:18
Takes a screenshot of a Windows Forms control using BitBlt, making it work with CefSharp's WinForms.ChromiumWebBrowser
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class ControlSnapshot
{
public static Bitmap Snapshot(Control c)
{
@jankurianski
jankurianski / ChromeOffscreen.cs
Last active August 29, 2015 14:09
CefSharp offscreen renderer
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using CefSharp;
@jankurianski
jankurianski / docking.patch
Created October 13, 2014 13:16
Move dock and visibility settings to designer so CEF gets right size on startup
From c4493f98dd1742bda6818cda48dd52d9dd7d419c Mon Sep 17 00:00:00 2001
From: jankurianski <[email protected]>
Date: Mon, 13 Oct 2014 23:55:09 +1100
Subject: [PATCH] Browser now docks properly on startup
---
.../BrowserTabUserControl.Designer.cs | 3 ++-
CefSharp.WinForms.Example/BrowserTabUserControl.cs | 18 ------------------
2 files changed, 2 insertions(+), 19 deletions(-)
@jankurianski
jankurianski / gist:6e3c6ddda54bbf6eba54
Created October 13, 2014 07:22
Avoid locking in premature size in CEF
bool setInitialSize = false;
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
if (setInitialSize && managedCefBrowserAdapter != null)
managedCefBrowserAdapter.OnSizeChanged();
}
protected override void OnVisibleChanged(EventArgs e)