Skip to content

Instantly share code, notes, and snippets.

View lettucebo's full-sized avatar
😶

Money lettucebo

😶
View GitHub Profile
@lettucebo
lettucebo / ms-learn-lang-switch-tw.js
Last active March 28, 2024 00:52
MS Learn 文件快速繁中英切換
// ==UserScript==
// @name 中英快速切換 - TW
// @namespace http://tampermonkey.net/
// @version 0.2
// @description MS Learn 文件中英文切換
// @author You
// @match https://learn.microsoft.com/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @downloadURL https://gist.githubusercontent.com/lettucebo/75f05f94b7ee2dace41b5ec06b6bf022/raw/548ae23f363124b5226d6c01181e1abe470f8574/ms-learn-lang-switch-tw.js
// @updateURL https://gist.githubusercontent.com/lettucebo/75f05f94b7ee2dace41b5ec06b6bf022/raw/548ae23f363124b5226d6c01181e1abe470f8574/ms-learn-lang-switch-tw.js
@lettucebo
lettucebo / ms-learn-lang-switch-cn.js
Last active February 4, 2024 17:18 — forked from darkthread/ms-learn-lang-switch.js
MS Learn 文件快速中英切換
// ==UserScript==
// @name 中英快速切換 - CN
// @namespace http://tampermonkey.net/
// @version 0.2
// @description MS Learn 文件中英文切換
// @author You
// @match https://learn.microsoft.com/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @downloadURL https://gist.githubusercontent.com/lettucebo/75f05f94b7ee2dace41b5ec06b6bf022/raw/548ae23f363124b5226d6c01181e1abe470f8574/ms-learn-lang-switch-cn.js
// @updateURL https://gist.githubusercontent.com/lettucebo/75f05f94b7ee2dace41b5ec06b6bf022/raw/548ae23f363124b5226d6c01181e1abe470f8574/ms-learn-lang-switch-cn.js
@lettucebo
lettucebo / install-vsix.ps1
Created April 22, 2021 09:05 — forked from ScottHutchinson/install-vsix.ps1
PowerShell scripts for batch installing Visual Studio extensions
# Based on http://nuts4.net/post/automated-download-and-installation-of-visual-studio-extensions-via-powershell
param([String] $PackageName)
$ErrorActionPreference = "Stop"
$baseProtocol = "https:"
$baseHostName = "marketplace.visualstudio.com"
$Uri = "$($baseProtocol)//$($baseHostName)/items?itemName=$($PackageName)"
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Handlers.RegisterGeography();
using (var conn = new SqlConnection(""))
{
USE [master]
GO
/****** Object: Database [Sample] Script Date: 2/9/2020 1:20:27 PM ******/
CREATE DATABASE [Sample]
GO
ALTER DATABASE [Sample] SET COMPATIBILITY_LEVEL = 150
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Sample].[dbo].[sp_fulltext_database] @action = 'enable'
// init logger
DevelopLogger developLogger = new DevelopLogger(new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.WithMachineName()
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger());
UserLogger userLogger = new UserLogger(new LoggerConfiguration()
.MinimumLevel.Debug()
// init logger
WsSerilog.UserLog = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.WithMachineName()
.Enrich.FromLogContext()
.WriteTo.Console()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri("http://localhost:9200"))
{
MinimumLogEventLevel = LogEventLevel.Information,
AutoRegisterTemplate = true,
var imageModeration =
client.ImageModeration.EvaluateUrlInput("", new BodyModel("URL", imageUrl));
Console.WriteLine($"IsImageAdultClassified: {imageModeration.IsImageAdultClassified}");
Console.WriteLine($"AdultClassificationScore: {imageModeration.AdultClassificationScore}");
Console.WriteLine($"IsImageRacyClassified: {imageModeration.IsImageRacyClassified}");
Console.WriteLine($"RacyClassificationScore: {imageModeration.RacyClassificationScore}");
ContentModeratorClient client = new ContentModeratorClient(new ApiKeyServiceClientCredentials(apiKey));
client.Endpoint = "https://southeastasia.api.cognitive.microsoft.com";
string apiKey = configuration.GetSection("apiKey").Value;
string imageUrl = "http://pic.pimg.tw/k110107632/1387547248-3785354604.jpg";