Skip to content

Instantly share code, notes, and snippets.

View Orlys's full-sized avatar
🍭

Oz Orlys

🍭
View GitHub Profile
@dtwk2
dtwk2 / UsbDetector
Last active November 15, 2021 16:26
#nullable enable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Management;
using System.Reactive.Linq;
using System.Reactive.Subjects;
/// <summary>
@louis-e
louis-e / UDPSocket.cs
Last active May 26, 2024 13:39 — forked from darkguy2008/UDPSocket.cs
Simple C# UDP server/client in 62 lines
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace UDP
{
public class UDPSocket
{
public Socket _socket;
@antonKrouglov
antonKrouglov / PathNetCore.cs
Created December 26, 2018 13:59
Port of Path.GetRelativePath (.NET Core2) to .NET 4.7.1+
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//Adapted from https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/IO/Path.cs#L697 for Windows
// by Anton Krouglov
using System.Runtime.CompilerServices;
using System.Diagnostics;
using System.Text;
@svrooij
svrooij / Certificates.cs
Last active November 26, 2023 11:20
C# generate X509Certificate2
/* By Stephan van Rooij
* See https://svrooij.nl/2018/04/generate-x509certificate2-in-csharp/
*/
using System;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.Utilities;
@DustinCampbell
DustinCampbell / using-msbuildworkspace.md
Created April 10, 2018 21:36
Using MSBuildWorkspace

Introduction

Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which to perform analysis can be challenging. For simple tasks, creating a Compilation populated with SyntaxTrees, MetadataReferences and a handful of options may suffice. However, if there are multiple projects involved in the analysis, it is more complicated because multiple Compilations need to be created with references between them.

To simplify the construction process. Roslyn provides the Workspace API, which can be used to model solutions, projects and documents. The Workspace API performs all of the heavy lifting needed to parse SyntaxTrees from source code, load MetadataReferences, and construct Compilations and add references between them.

@sorashi
sorashi / readme.md
Last active September 28, 2018 20:12
Custom AppVeyor webhook for Discord
{
  "embeds": [
    {
      "title": "Build {{buildId}}",
      "url": "{{buildUrl}}",
      "color": {{#passed}}40973{{/passed}}{{^passed}}11672839{{/passed}},
      "footer": {
        "icon_url": "{{#passed}}https://i.imgur.com/Rf4g8v6.png{{/passed}}{{^passed}}https://i.imgur.com/QaERwAW.png{{/passed}}",
 "text": "{{#passed}}Success{{/passed}}{{^passed}}Failure{{/passed}}"
@therightstuff
therightstuff / RSAKeys.cs
Last active May 24, 2024 14:20
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@fotock
fotock / nginx.conf
Last active July 10, 2024 03:08 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@poychang
poychang / privacy-policy-template-eng.md
Last active April 29, 2024 11:39
隱私權條款範本

Privacy Policy Template

Welcome to [Your Website Name] (hereinafter referred to as "the Website"). In order to provide you with a secure and seamless experience while using the various services and information on our website, we are committed to protecting your privacy rights. Please read the following information carefully:

1. Scope of Privacy Policy

This Privacy Policy outlines how we handle the collection, processing, and utilization of personal identifiable information when you use our website's services. This Privacy Policy does not apply to other related websites not operated by us or to individuals not managed or commissioned by us.

2. Collection, Processing, and Utilization of Personal Data