This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System.Runtime.CompilerServices; | |
using System.Text.Json; | |
using System.Text.Json.Serialization.Metadata; | |
public static class JsonSerializerExt | |
{ | |
// Dynamically attach a JsonSerializerOptions copy that is configured using PopulateTypeInfoResolver | |
private readonly static ConditionalWeakTable<JsonSerializerOptions, JsonSerializerOptions> s_populateMap = new(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://forum.unity.com/threads/line-intersection.17384/#post-4442284 | |
bool FasterLineSegmentIntersection (Vector2 line1point1, Vector2 line1point2, Vector2 line2point1, Vector2 line2point2) { | |
Vector2 a = line1point2 - line1point1; | |
Vector2 b = line2point1 - line2point2; | |
Vector2 c = line1point1 - line2point1; | |
float alphaNumerator = b.y * c.x - b.x * c.y; | |
float betaNumerator = a.x * c.y - a.y * c.x; | |
float denominator = a.y * b.x - a.x * b.y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ansible playbook to setup HTTPS using Let's encrypt on nginx. | |
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS. | |
The server pass A rating on [SSL Labs](https://www.ssllabs.com/). | |
To use: | |
1. Install [Ansible](https://www.ansible.com/) | |
2. Setup an Ubuntu 16.04 server accessible over ssh | |
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain | |
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Globalization; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace AwsV4SignatureCalculator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Convert-XmlElementToString | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
$xml | |
) | |
$sw = [System.IO.StringWriter]::new() | |
$xmlSettings = [System.Xml.XmlWriterSettings]::new() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @tableName varchar(200) | |
declare @columnName varchar(200) | |
declare @nullable varchar(50) | |
declare @datatype varchar(50) | |
declare @maxlen int | |
declare @sType varchar(50) | |
declare @sProperty varchar(200) | |
DECLARE table_cursor CURSOR FOR |
What if your team uses TFS, but you want offline support? You can have a Git repo as well, but then getting your changes to TFS is burdensome. Here’s where a GIT to TFS bridge would be handy.
Here’s how to keep a TFS repository foo, and a GIT repository bar, in sync. First step is you need to create a new TFS workspace:
cd \
tf workspace /new /noprompt Foo