Ⅰ. はじめに
タイトルの通り「Visual StudioのIntelliCodeをオフにする方法」です。
Ⅱ. 手順
1. VisualStudioのツール→オプションをクリック
2. 「無効」に設定する
実行結果
設定前 | |
設定後 |
タイトルの通り「Visual StudioのIntelliCodeをオフにする方法」です。
設定前 | |
設定後 |
タイトルの通り「C#でLZ4を利用して圧縮展開する方法」です。
dotnet add package K4os.Compression.LZ4 --version 1.3.5
Program.cs
using K4os.Compression.LZ4; var originalBytes = Encoding.UTF8.GetBytes("hello world"); // 圧縮 var encodedBytes = new byte[256]; var length = LZ4Codec.Encode(originalBytes, encodedBytes); encodedBytes = encodedBytes.Take(length).ToArray(); Console.WriteLine(BitConverter.ToString(encodedBytes)); // 展開 var decodedBytes = new byte[256]; length = LZ4Codec.Decode(encodedBytes, decodedBytes); decodedBytes = decodedBytes.Take(length).ToArray(); Console.WriteLine(BitConverter.ToString(decodedBytes));
B0-68-65-6C-6C-6F-20-77-6F-72-6C-64 68-65-6C-6C-6F-20-77-6F-72-6C-64
// https://docs.microsoft.com/ja-jp/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-6.0 var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/todos/{id:int}", (int id) => db.Todos.Find(id)); app.MapGet("/todos/{text}", (string text) => db.Todos.Where(t => t.Text.Contains(text)); app.MapGet("/posts/{slug:regex(^[a-z0-9_-]+$)}", (string slug) => $"Post {slug}"); app.Run();
タイトルの通り「puppeteerでproxyを利用する方法」です。
const browser = await puppeteer.launch({ args: [ '--proxy-server=127.0.0.1:8080' ] });
省略
npm i puppeteer npm i puppeteer-proxy # HTTP, HTTPS npm install https-proxy-agent # SOCKS5 npm i socks-proxy-agent
index.js
const puppeteer = require('puppeteer'); const { proxyRequest } = require('puppeteer-proxy'); const HttpsProxyAgent = require('https-proxy-agent'); const SocksProxyAgent = require('socks-proxy-agent'); (async () => { const browser = await puppeteer.launch({ defaultViewport: null, headless: false, slowMo: 300 }) const page = await browser.newPage() const agent = { http: new HttpsProxyAgent('http://127.0.0.1:3128'), https: new HttpsProxyAgent('http://127.0.0.1:3128'), // http: new HttpsProxyAgent('http://user:pass@127.0.0.1:3128'), // https: new HttpsProxyAgent('http://user:pass@127.0.0.1:3128'), } /* const agent = { http: new SocksProxyAgent('socks5://127.0.0.1:1080'), https: new SocksProxyAgent('socks5://127.0.0.1:1080'), // http: new SocksProxyAgent('socks5://user:pass@127.0.0.1:1080'), // https: new SocksProxyAgent('socks5://user:pass@127.0.0.1:1080'), } */ await page.setRequestInterception(true); page.on('request', async (request) => { await proxyRequest({ agent, page, request, }); }); await page.goto('https://api.ipify.org/') })()
省略
タイトルの通り「C#でJavaScriptを実行する方法」です。
Install-Package Microsoft.ClearScript
using Microsoft.ClearScript.V8; using var engine = new V8ScriptEngine(); engine.AddHostType("Console", typeof(Console)); engine.Execute("Console.WriteLine('hello world')"); engine.AddHostObject("random", new Random()); engine.Execute("Console.WriteLine(random.Next(0, 10))"); engine.Execute("var result = 1 + 1"); Console.WriteLine(engine.Script.result); engine.Execute("function sum (x, y) { return x + y }"); Console.WriteLine(engine.Script.sum(1, 2)); engine.ExecuteCommand("var user = { id: 1, name: 'tanaka' }"); Console.WriteLine(engine.Script.user.id); Console.WriteLine(engine.Script.user.name);
hello world 4 2 3 1 tanaka